next up previous contents
Next: Shape Up: Tensor operations Previous: Slice   Contents

Size

\includegraphics[height=10mm]{images/size}% WIDTH=48 HEIGHT=45

The operator can be placed on the canvas in two ways:

Size refers to the number of elements along a named dimension given by the operation axis argument—eg a $3\times2$% WIDTH=71 HEIGHT=23 rank 2 tensor with named axes ``0'' and ``1'', size(``1'')==2.

If the axis argument is left blank, the size returns the total number of elements present in the tensor. This may be less than the product of axis sizes if the data is sparse—which will normally be the case.