MCPcopy Create free account
hub / github.com/cogentcore/core / Len

Method Len

tensor/shape.go:58–67  ·  view source on GitHub ↗

Len returns the total length of elements in the tensor (i.e., the product of the shape sizes)

()

Source from the content-addressed store, hash-verified

56// Len returns the total length of elements in the tensor
57// (i.e., the product of the shape sizes)
58func (sh *Shape) Len() int {
59 if len(sh.Sizes) == 0 {
60 return 0
61 }
62 o := int(1)
63 for _, v := range sh.Sizes {
64 o *= v
65 }
66 return int(o)
67}
68
69// NumDims returns the total number of dimensions.
70func (sh *Shape) NumDims() int { return len(sh.Sizes) }

Callers 3

RowCellSizeMethod · 0.95
WriteCSVRowWriterMethod · 0.95
TableHeadersMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected