MCPcopy Create free account
hub / github.com/egonelbre/exp / New

Function New

niterator/shape/shape.go:22–37  ·  view source on GitHub ↗
(shape ...int)

Source from the content-addressed store, hash-verified

20}
21
22func New(shape ...int) *AP {
23 ap := &AP{}
24 ap.Shape = shape
25 ap.Stride = make([]int, len(shape))
26
27 acc := 1
28 for i := len(shape) - 1; i >= 0; i-- {
29 ap.Stride[i] = acc
30 d := shape[i]
31 if d < 0 {
32 panic("negative dimension size does not make sense")
33 }
34 acc *= d
35 }
36 return ap
37}

Callers 2

iterator_test.goFile · 0.92

Calls

no outgoing calls

Tested by 1