IndexIsValid() returns true if given index is valid (within ranges for all dimensions)
(idx []int)
| 94 | |
| 95 | // IndexIsValid() returns true if given index is valid (within ranges for all dimensions) |
| 96 | func (sh *Shape) IndexIsValid(idx []int) bool { |
| 97 | if len(idx) != sh.NumDims() { |
| 98 | return false |
| 99 | } |
| 100 | for i, v := range sh.Sizes { |
| 101 | if idx[i] < 0 || idx[i] >= v { |
| 102 | return false |
| 103 | } |
| 104 | } |
| 105 | return true |
| 106 | } |
| 107 | |
| 108 | // IsEqual returns true if this shape is same as other (does not compare names) |
| 109 | func (sh *Shape) IsEqual(oth *Shape) bool { |
no test coverage detected