emer / etable

Data table structure in Go, now developed at https://github.com/cogentcore/core/tree/main/tensor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SetShape on an existing etensor does not set column major

rohrlich opened this issue · comments

I cloned an etensor and then called SetShape on it changing shape and also the strides using ColMajorStrides. The shape was changed but "IsColMajor" returns false afterwards.

The same scenario on a new etensor did return true for IsColMajor().

is this still a valid bug?

I'll test tonight

Yes still a bug, here is my test code:

tsr := etensor.New(etensor.INT16, []int{4,5}, nil, nil)
newtsr := tsr.Clone()
newtsr.SetShape([]int{5,4}, []int{4,1}, nil)
if newtsr.IsColMajor() {
	fmt.Println("yes is col major!")
}

well I've never tested anything to do with col major so there easily could be a bug -- could you look into it and fix anything you find. it is all pretty clear in etensor what IsColMajor does -- just compares stride to what it would compute, so it should be easy to see what's wrong.

Yes still valid, here is my test code:

tsr := etensor.New(etensor.INT16, []int{4,5}, nil, nil)
newtsr := tsr.Clone()
newtsr.SetShape([]int{5,4}, []int{4,1}, nil)
if newtsr.IsColMajor() {
	fmt.Println("yes is col major!")
}

Sure but I might not get to until 12/26.

Closing - not a bug. The strides I passed in were wrong! Next time I'll call ColMajorStrides() rather than trying to figure them out myself.