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

Method CopyFrom

tensor/bits.go:266–275  ·  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

264// optimized implementation if the other tensor is of the same type, and
265// otherwise it goes through appropriate standard type.
266func (tsr *Bits) CopyFrom(frm Tensor) {
267 if fsm, ok := frm.(*Bits); ok {
268 copy(tsr.Values, fsm.Values)
269 return
270 }
271 sz := min(len(tsr.Values), frm.Len())
272 for i := 0; i < sz; i++ {
273 tsr.Values.Set(i, Float64ToBool(frm.Float1D(i)))
274 }
275}
276
277// CopyShapeFrom copies just the shape from given source tensor
278// calling SetShape with the shape params from source (see for more docs).

Callers

nothing calls this directly

Calls 4

Float64ToBoolFunction · 0.85
LenMethod · 0.65
SetMethod · 0.65
Float1DMethod · 0.65

Tested by

no test coverage detected