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
array([[0., 0.],
[0., 0.],
[0., 0.]])
and b.shape is (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
Data([[0., 0.],
[0., 0.]], dtype=float32)
and hence g.shape is (2, 2).
Note that f.data[::2, ::2].T returns
Data([[0., 0.],
[0., 0.],
[0., 0.]], dtype=float32)
and f.data.T returns
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.
As described in the title. MFE below.
Consider the following numpy array operation:
We then have that
bis given byand
b.shapeis(3, 2).We would expected similar behavior from the Devito
Datatype:but in this case,
gisand hence
g.shapeis(2, 2).Note that
f.data[::2, ::2].Treturnsand
f.data.Treturnswhich is of the correct form, but slicing this transposed
Datawill in many cases result in an incorrect output.It would seem that some property of the
Dataobject is not being properly updated by the transpose operation.