Size returns the size of the dim-th dimension of the shape, or -1 if it is unknown. REQUIRES: 0 <= dim < s.NumDimensions()
(dim int)
| 59 | // |
| 60 | // REQUIRES: 0 <= dim < s.NumDimensions() |
| 61 | func (s Shape) Size(dim int) int64 { |
| 62 | if dim < 0 || dim >= s.NumDimensions() { |
| 63 | return -1 |
| 64 | } |
| 65 | return s.dims[dim] |
| 66 | } |
| 67 | |
| 68 | // IsFullySpecified returns true iff the size of all the dimensions of s are |
| 69 | // known. |