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

Method CopyFrom

tensor/string.go:223–232  ·  view source on GitHub ↗

CopyFrom copies all avail values from other tensor into this tensor, with an optimized implementation if the other tensor is of the same type, and otherwise it goes through appropriate standard type.

(frm Tensor)

Source from the content-addressed store, hash-verified

221// optimized implementation if the other tensor is of the same type, and
222// otherwise it goes through appropriate standard type.
223func (tsr *String) CopyFrom(frm Tensor) {
224 if fsm, ok := frm.(*String); ok {
225 copy(tsr.Values, fsm.Values)
226 return
227 }
228 sz := min(len(tsr.Values), frm.Len())
229 for i := 0; i < sz; i++ {
230 tsr.Values[i] = Float64ToString(frm.Float1D(i))
231 }
232}
233
234// CopyShapeFrom copies just the shape from given source tensor
235// calling SetShape with the shape params from source (see for more docs).

Callers

nothing calls this directly

Calls 3

Float64ToStringFunction · 0.85
LenMethod · 0.65
Float1DMethod · 0.65

Tested by

no test coverage detected