RowCellSize returns the size of the outer-most Row shape dimension, and the size of all the remaining inner dimensions (the "cell" size). Used for Tensors that are columns in a data table.
()
| 120 | // and the size of all the remaining inner dimensions (the "cell" size). |
| 121 | // Used for Tensors that are columns in a data table. |
| 122 | func (sh *Shape) RowCellSize() (rows, cells int) { |
| 123 | rows = sh.Sizes[0] |
| 124 | if len(sh.Sizes) == 1 { |
| 125 | cells = 1 |
| 126 | } else { |
| 127 | cells = sh.Len() / rows |
| 128 | } |
| 129 | return |
| 130 | } |
| 131 | |
| 132 | // Offset returns the "flat" 1D array index into an element at the given n-dimensional index. |
| 133 | // No checking is done on the length or size of the index values relative to the shape of the tensor. |