AddTensorColumn adds a new n-dimensional column to the table, of given type, column name (which must be unique), and dimensionality of each _cell_. An outer-most Row dimension will be added to this dimensionality to create the tensor column.
(dt *Table, name string, cellSizes []int, dimNames ...string)
| 168 | // An outer-most Row dimension will be added to this dimensionality to create |
| 169 | // the tensor column. |
| 170 | func AddTensorColumn[T string | bool | float32 | float64 | int | int32 | byte](dt *Table, name string, cellSizes []int, dimNames ...string) tensor.Tensor { |
| 171 | rows := max(1, dt.Rows) |
| 172 | sz := append([]int{rows}, cellSizes...) |
| 173 | nms := append([]string{"Row"}, dimNames...) |
| 174 | tsr := tensor.New[T](sz, nms...) |
| 175 | dt.AddColumn(tsr, name) |
| 176 | return tsr |
| 177 | } |
| 178 | |
| 179 | // AddColumn adds the given tensor as a column to the table, |
| 180 | // returning an error and not adding if the name is not unique. |