MCPcopy Create free account
hub / github.com/cogentcore/core / SetTensorIndex

Method SetTensorIndex

tensor/table/table.go:632–650  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
632func (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.

Callers 1

SetTensorMethod · 0.95

Implementers 1

_cogentcore_org_core_plot_plots_Tableyaegicore/symbols/cogentcore_org-core-

Calls 8

IsValidRowMethod · 0.95
RowCellSizeMethod · 0.65
LenMethod · 0.65
IsStringMethod · 0.65
SetString1DMethod · 0.65
String1DMethod · 0.65
SetFloat1DMethod · 0.65
Float1DMethod · 0.65

Tested by

no test coverage detected