pytorch
8b53515b - Add ONNX Export Support for torch.scalar_tensor (#28713)

Commit
5 years ago
Add ONNX Export Support for torch.scalar_tensor (#28713) Summary: Support exporting torch.scalar_tensor() to ONNX. This will allow making operations on dynamic scalars (like x.size(dim) where x is a tensor of dynamic shape) and exporting them to ONNX. This is a dummy example of operations that could not be exported dynamically before this PR: ``` size_x = x.size(0) size_y = y.size(0) size_x_y_static = torch.tensor([size_x , size_y]) # size_x_y_static is traced as constant size_x = torch.scalar_tensor(size_x).unsqueeze(0) size_y = torch.scalar_tensor(size_y).unsqueeze(0) size_x_y_dynamic = torch.cat((size_x , size_y)) # size_x_y_dynamic is dynamic and depends on x and y's size ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/28713 Reviewed By: hl475 Differential Revision: D18438880 Pulled By: houseroad fbshipit-source-id: c1651e480a41602c7c7452ffc4acba40a2b3827c
Author
Parents
Loading