Skip to content

πŸ› [Bug] Encountered bug when using Torch-TensorRT (We don't have an op for aten::floor_divide but it isn't a special case)Β #1305

Closed
@ghazalehtrb

Description

@ghazalehtrb

Bug Description

Hi, I'm trying to compile a model with torch_tensorrt. I was able to successfully create the scripted model but when compiling it I'm getting the following error:

INFO: [Torch-TensorRT] - ir was set to default, using TorchScript as ir
DEBUG: [Torch-TensorRT] - Settings requested for Lowering:
    torch_executed_modules: [
    ]
Traceback (most recent call last):
  File "test.py", line 103, in <module>
    trt_model = torch_tensorrt.compile(scripted_model,
  File "/media/andrea/Disk_21/Desktop/ARES/leav-action-recognition-pipeline/test_env/lib/python3.8/site-packages/torch_tensorrt/_compile.py", line 115, in compile
    return torch_tensorrt.ts.compile(ts_mod, inputs=inputs, enabled_precisions=enabled_precisions, **kwargs)
  File "/media/andrea/Disk_21/Desktop/ARES/leav-action-recognition-pipeline/test_env/lib/python3.8/site-packages/torch_tensorrt/ts/_compiler.py", line 113, in compile
    compiled_cpp_mod = _C.compile_graph(module._c, _parse_compile_spec(spec))
RuntimeError: 0INTERNAL ASSERT FAILED at "../torch/csrc/jit/ir/alias_analysis.cpp":607, please report a bug to PyTorch. We don't have an op for aten::floor_divide but it isn't a special case.  Argument types: int, int, 

Candidates:
	aten::floor_divide(Tensor self, Tensor other) -> (Tensor)
	aten::floor_divide.Scalar(Tensor self, Scalar other) -> (Tensor)
	aten::floor_divide.out(Tensor self, Tensor other, *, Tensor(a!) out) -> (Tensor(a!))

I don't know which part of the model is exactly causing this error yet, I'll post a simple version once I figure it out but I think torch_tensortrt 1.1.0 release is supposed to support floor_divide.

This is what I'm doing to compile the model:

model.eval().cuda()
scripted_model = torch.jit.script(model)

with torch_tensorrt.logging.debug():
    trt_model = torch_tensorrt.compile(scripted_model,
                    inputs = [torch_tensorrt.Input((1, 3, 16, 344, 344))],
                    enabled_precisions= {torch.half},
                    workspace_size= 1 << 20,
                    truncate_long_and_double=True,
                    require_full_compilation=False, #True
                )

Expected behavior

I was expecting floor_divide to be supported in the 1.1.0 release based on the information given here: https://github.com/pytorch/TensorRT/releases

Environment

  • Torch-TensorRT Version: 1.1.0
  • PyTorch Version: 1.11.0+cu113
  • CPU Architecture: x86_64
  • OS: Ubuntu 20.04
  • How you installed PyTorch: pip
  • Python version: 3.8
  • CUDA version: 11.3
  • GPU models and configuration: NVIDIA GeForce RTX 3070

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions