(shape ...int)
| 20 | } |
| 21 | |
| 22 | func 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 | } |
no outgoing calls