SetTensorIndex sets the tensor value of cell at given column, row index for columns that have n-dimensional tensors. Returns true if set.
(column, row int, val tensor.Tensor)
| 630 | // SetTensorIndex sets the tensor value of cell at given column, row index |
| 631 | // for columns that have n-dimensional tensors. Returns true if set. |
| 632 | func (dt *Table) SetTensorIndex(column, row int, val tensor.Tensor) bool { |
| 633 | if !dt.IsValidRow(row) { |
| 634 | return false |
| 635 | } |
| 636 | ct := dt.Columns[column] |
| 637 | _, csz := ct.RowCellSize() |
| 638 | st := row * csz |
| 639 | sz := min(csz, val.Len()) |
| 640 | if ct.IsString() { |
| 641 | for j := 0; j < sz; j++ { |
| 642 | ct.SetString1D(st+j, val.String1D(j)) |
| 643 | } |
| 644 | } else { |
| 645 | for j := 0; j < sz; j++ { |
| 646 | ct.SetFloat1D(st+j, val.Float1D(j)) |
| 647 | } |
| 648 | } |
| 649 | return true |
| 650 | } |
| 651 | |
| 652 | // SetTensor sets the tensor value of cell at given column (by name), row index |
| 653 | // for columns that have n-dimensional tensors. Returns true if set. |
no test coverage detected