Skip to content
New issue

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

Support memref's with negative strides #158

Open
markkraay opened this issue Aug 29, 2024 · 0 comments
Open

Support memref's with negative strides #158

markkraay opened this issue Aug 29, 2024 · 0 comments

Comments

@markkraay
Copy link
Collaborator

markkraay commented Aug 29, 2024

Memrefs should be able to support negative strides.

>>> import tripy as tp
>>> import numpy as np
>>> a = np.ones((2,2))
>>> a = np.flip(a)
>>> tp.Tensor(a)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tripy/tripy/frontend/tensor.py", line 117, in __init__
    data = memref.create_memref_view(data)
  File "/tripy/tripy/backend/mlir/memref.py", line 44, in create_memref_view
    return mlir_utils.MLIRRuntimeClient().create_memref_view_from_dlpack(data.__dlpack__())
mlir_tensorrt.runtime._mlir_libs._api.MTRTException: InvalidArgument: InvalidArgument: only memrefs with non-negative strides are allowed
>>> output = tp.Tensor(np.arange(10, dtype=np.int32)[8:2:-1])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tripy/tripy/frontend/tensor.py", line 117, in __init__
    data = memref.create_memref_view(data)
  File "/tripy/tripy/backend/mlir/memref.py", line 44, in create_memref_view
    return mlir_utils.MLIRRuntimeClient().create_memref_view_from_dlpack(data.__dlpack__())
mlir_tensorrt.runtime._mlir_libs._api.MTRTException: InvalidArgument: InvalidArgument: only memrefs with non-negative strides are allowed
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

No branches or pull requests

1 participant