Skip to content

Conversation

@darkestpigeon
Copy link
Contributor

What?

Fixing a bug with reshape, where it mistakes a non-contiguous C layout for contiguous F layout (see issue #660).

Why

A simple illustration why this is a problem:

import arraymancer

let x = arange[float](0, 6).reshape(2, 3).permute(1, 0) # has shape [3, 2] and is not C-contiguous (but is F-contiguous)
let y = x.reshape(3*2).reshape(3, 2) # the reshapes shouldn't change the contents

echo x
echo y
doAssert x == y

Right now this assertion fails.

How

The check for whether the tensor is F-contiguous is removed. No-copy reshape is only performed if the tensor is C-contiguous.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant