Solved by babababadukeduke in post #2 
              
              
                Figure it out! I have to make the tensor contiguous before reducing it. This article provides a nice description of it.