- I want to measure the execution time of “torch.ops.aten.embedding.default” operation. My code -
primals_2 = torch.rand(2, 768, dtype=torch.float32)
primals_205 = torch.randint(1, 5000, [1, 62], dtype=torch.int64)
embedding_1 = torch.ops.aten.embedding.default(primals_2, primals_205)
Here, primals_2 and primals_205 are two random tensors. I got the shape of these two tensors from FX graph. While I am executing the code snippet, I am getting following error -
Traceback (most recent call last):
File “operation_test.py”, line 36, in
embedding_1 = torch.ops.aten.embedding.default(primals_2, primals_205)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/miniconda3/envs/pytorch/lib/python3.11/site-packages/torch/_ops.py”, line 513, in call
return self._op(*args, **(kwargs or {}))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IndexError: index out of range in self
- for the “torch.ops.prims.unsafe_index_put.default” operation execution -
slice_4 = torch.randint(1, 5000, [1, 62], dtype=torch.int64)
full_default_3 = torch.rand(512, 768, dtype=torch.float32)
_unsafe_index_put = torch.ops.prims._unsafe_index_put_.default(full_default_3, slice_4, where, True)
I am getting following error -
Traceback (most recent call last):
File “operation_test.py”, line 38, in
_unsafe_index_put = torch.ops.prims.unsafe_index_put.default(full_default_3, slice_4, where, True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/miniconda3/envs/pytorch/lib/python3.11/site-packages/torch/_ops.py”, line 822, in getattr
raise AttributeError(
AttributeError: ‘_OpNamespace’ ‘prims’ object has no attribute ‘unsafe_index_put’
- for operation “torch.ops.aten.index_put_.default”
full_default_16 = torch.randint(1, 5000, [1], dtype=torch.int64)
remainder = torch.randint(1, 5000, [1], dtype=torch.int64)
full_default_17 = torch.rand(1, 54, 2, dtype=torch.float32)
tangents_1 = torch.rand(1, 2, dtype=torch.float32)
index_put = torch.ops.aten.index_put_.default(full_default_17, [full_default_16, remainder], tangents_1, True)
Traceback (most recent call last):
File “operation_test.py”, line 40, in
index_put = torch.ops.aten.index_put_.default(full_default_17, [full_default_16, remainder], tangents_1, True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/miniconda3/envs/pytorch/lib/python3.11/site-packages/torch/_ops.py”, line 513, in call
return self._op(*args, **(kwargs or {}))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IndexError: index 4451 is out of bounds for dimension 0 with size 1
I am getting this operation list for Bert model. Any kind of help will be appreciated.