Closed strigi-form closed 3 years ago
can you give an example?
Yes, it is in issue #83, here is a copy/paste This simple code panics 2020/10/15 13:11:28 (3, 1) C[-1 %!v(PANIC=Format method: runtime error: index out of range [3] with length 3)
package main
import (
"log"
"gorgonia.org/tensor"
)
func main() {
var T tensor.Tensor
T = tensor.New(
tensor.WithShape(1, 3),
tensor.WithBacking([]float64{-1, 0, 1}))
T, _ = tensor.T(T)
log.Printf("%v\n%v\n", T.Shape(), T)
}
The problem is you can't iterate on a transposed *tensor.Dense (tensor.AP in fact) when IsRowVec() is true:
it := tensor.IteratorFromDense(t.tens.(*tensor.Dense))
for i, ierr := it.Next(); ierr == nil; i, ierr = it.Next() {
.....
}
First value for i is ok, but next is dimension (or stride which is 3 in my example), so panic out of range
OK analysing
I edited your comment above to point to #83 which very clearly shows the problem
This LGTM. It passes on my local machine. No idea why it fails in travis
strides must be permuted for 2d tensors with any dimension == 1