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

Method SetShape

tensor/shape.go:39–46  ·  view source on GitHub ↗

SetShape sets the shape size and optional names RowMajor ordering is used by default.

(sizes []int, names ...string)

Source from the content-addressed store, hash-verified

37// SetShape sets the shape size and optional names
38// RowMajor ordering is used by default.
39func (sh *Shape) SetShape(sizes []int, names ...string) {
40 sh.Sizes = slices.Clone(sizes)
41 sh.Strides = RowMajorStrides(sizes)
42 sh.Names = make([]string, len(sh.Sizes))
43 if len(names) == len(sizes) {
44 copy(sh.Names, names)
45 }
46}
47
48// CopyShape copies the shape parameters from another Shape struct.
49// copies the data so it is not accidentally subject to updates.

Callers 1

NewShapeFunction · 0.95

Calls 2

RowMajorStridesFunction · 0.85
CloneMethod · 0.65

Tested by

no test coverage detected