Commit ac5af77
committed
review: apply @mloubout's suggestions
* use ``devito.tools.as_tuple`` to normalize the polymorphic ``axes`` of
``transpose`` (no-args, single ``None``, single tuple/list, or
individual positional args all collapse to a flat tuple).
* drop the ``isinstance(ret, Data)`` guards in ``transpose`` and
``swapaxes`` -- ``numpy.ndarray.<view-op>`` preserves the subclass via
``__array_finalize__``, so ``ret`` is always a ``Data``.
* replace the hand-built reference in ``test_slice_after_transpose``
with ``ref = np.array(f.data)`` (and the 3D equivalent for ``g``),
removing the duplicated ``arange/reshape/astype`` lines; shape and
values are still compared against the NumPy reference array via
``np.array_equal``.1 parent b72317a commit ac5af77
2 files changed
Lines changed: 27 additions & 42 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
231 | 231 | | |
232 | 232 | | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
237 | 236 | | |
238 | 237 | | |
239 | 238 | | |
| |||
245 | 244 | | |
246 | 245 | | |
247 | 246 | | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
254 | 252 | | |
255 | 253 | | |
256 | 254 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | | - | |
227 | | - | |
| 226 | + | |
228 | 227 | | |
229 | 228 | | |
230 | | - | |
231 | | - | |
232 | | - | |
| 229 | + | |
233 | 230 | | |
234 | 231 | | |
235 | | - | |
236 | | - | |
237 | | - | |
| 232 | + | |
238 | 233 | | |
239 | 234 | | |
240 | | - | |
241 | | - | |
242 | | - | |
| 235 | + | |
| 236 | + | |
243 | 237 | | |
244 | 238 | | |
245 | | - | |
246 | | - | |
247 | | - | |
| 239 | + | |
| 240 | + | |
248 | 241 | | |
249 | 242 | | |
250 | 243 | | |
251 | 244 | | |
252 | 245 | | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
| 246 | + | |
258 | 247 | | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
264 | 251 | | |
265 | 252 | | |
266 | 253 | | |
| |||
0 commit comments