-
Notifications
You must be signed in to change notification settings - Fork 681
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
'TypeError: add_constant(): incompatible function arguments' while executing torch.Tensor.reshape() #363
Comments
Hi @przybyszewskiw, Thanks for sharing this issue. There is an experimental PR to support adding custom converters for user defined methods. Because the grid map seems to be constant for a given image shape, I'm curious if this would help here. For example, def convert_example(ctx):
module = ctx.method_args[0]
feature_map = ctx.method_args[1]
grid_size = feature_map.shape[-2:]
# ... (insert TensorRT code to add grid as constant)
output = ctx.method_return
output._trt = # ... set output _trt attribute to constant
class Example(nn.Module):
@tensorrt_method(convert_example)
def forward(self, feature_map):
# ... Please let me know if this helps or you run into any issues. Best, |
Got the similar error here:
Invoked with: <tensorrt.tensorrt.INetworkDefinition object at 0x7fa66bc4aca8>, (336,), array([ 0 ..... 335]) I think mine is caused by the unsupported function torch.arange since it shows |
Hello, I also faced the same problem. Did you able to solve it?
|
For me, it was this line which induced the error. File "/home/xxx/python3.8/site-packages/torch/nn/modules/batchnorm.py", line 147, in forward
self.num_batches_tracked = self.num_batches_tracked + 1 # type: ignore[has-type] It doesn't make sense that tensorrt doesn't support batchnorm. Then I realized that I forgot to call |
For the following code:
I get an error:
I'm using
PyTorch
version 1.6.0a0+9907a3e andTensorRT
7.1.2-1+cuda11.0. I was tryingtorch2trt
both with and without plugins.The text was updated successfully, but these errors were encountered: