We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data
transpose()
As described in the title. MFE below.
Consider the following numpy array operation:
import numpy as np a = np.zeros((4, 6)) b = a.T[::2, ::2]
We then have that b is given by
b
array([[0., 0.], [0., 0.], [0., 0.]])
and b.shape is (3, 2).
b.shape
(3, 2)
We would expected similar behavior from the Devito Data type:
grid = Grid(shape=(4, 6)) f = Function(name='f', grid=grid) g = f.data.T[::2, ::2]
but in this case, g is
g
Data([[0., 0.], [0., 0.]], dtype=float32)
and hence g.shape is (2, 2).
g.shape
(2, 2)
Note that f.data[::2, ::2].T returns
f.data[::2, ::2].T
Data([[0., 0.], [0., 0.], [0., 0.]], dtype=float32)
and f.data.T returns
f.data.T
Data([[0., 0., 0., 0.], [0., 0., 0., 0.], [0., 0., 0., 0.], [0., 0., 0., 0.], [0., 0., 0., 0.], [0., 0., 0., 0.]], dtype=float32)
which is of the correct form, but slicing this transposed Data will in many cases result in an incorrect output.
It would seem that some property of the Data object is not being properly updated by the transpose operation.
The text was updated successfully, but these errors were encountered:
I should add that a temporary workaround for anyone encountering this bug is to slice first, and then transpose the Data object.
Sorry, something went wrong.
rhodrin
No branches or pull requests
As described in the title. MFE below.
Consider the following numpy array operation:
We then have that
b
is given byand
b.shape
is(3, 2)
.We would expected similar behavior from the Devito
Data
type:but in this case,
g
isand hence
g.shape
is(2, 2)
.Note that
f.data[::2, ::2].T
returnsand
f.data.T
returnswhich is of the correct form, but slicing this transposed
Data
will in many cases result in an incorrect output.It would seem that some property of the
Data
object is not being properly updated by the transpose operation.The text was updated successfully, but these errors were encountered: