MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / ToSlice

Method ToSlice

tensorflow/go/shape.go:84–91  ·  view source on GitHub ↗

ToSlice returns the (possibly partially known) shape represented by s as a slice, or an error if the number of dimensions is not known.

()

Source from the content-addressed store, hash-verified

82// ToSlice returns the (possibly partially known) shape represented by s as a
83// slice, or an error if the number of dimensions is not known.
84func (s Shape) ToSlice() ([]int64, error) {
85 if s.dims == nil {
86 return nil, fmt.Errorf("cannot create a slice for a Shape with an unknown number of dimensions")
87 }
88 cpy := make([]int64, len(s.dims))
89 copy(cpy, s.dims)
90 return cpy, nil
91}
92
93func (s Shape) String() string {
94 if s.dims == nil {

Callers 2

TestZeroShapeFunction · 0.95
TestShapeFunction · 0.80

Calls 2

makeFunction · 0.85
copyFunction · 0.50

Tested by 2

TestZeroShapeFunction · 0.76
TestShapeFunction · 0.64