-
Notifications
You must be signed in to change notification settings - Fork 675
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
expand unsupported #486
Comments
Following converter seems to work @torch2trt.tensorrt_converter('torch.Tensor.expand')
def convert_expand(ctx):
input = ctx.method_args[0]
sizes = ctx.method_args[1:]
output = ctx.method_return
inshape = tuple(input.shape)[1:]
shape = sizes[1:] # exclude batch
ndim = len(shape)
start = tuple([0]*ndim)
stride = tuple([int(i == o) for i, o in zip(inshape, shape)]) # stride == 1 if dimensions match, 0 otherwise
layer = ctx.network.add_slice(input._trt, start, shape, stride)
output._trt = layer.get_output(0)
print(output._trt.shape) |
converter now added in master as of #487 |
@jaybdub Hi John, I failed to pass this module, Here is the log I met. in the module of convert_expand, how can we change input to input._trt? |
expand broadcasts tensors along specified dimensions.
https://pytorch.org/docs/stable/tensors.html
The text was updated successfully, but these errors were encountered: