pytorch
710fe405 - [Export] Introduce as_none in ex.Argument union type (#93210)

Commit
1 year ago
[Export] Introduce as_none in ex.Argument union type (#93210) This design has two implications - We are **NOT** modeling nullable argument types, e.g `Tesnor?`, `int?`, `int[]?` as a special argument type - Python None is treated as a special argument type, downstream executor/runtime need know to handle this. For aten.convolution's schmea, it accepts an optional input: `Tensor? bias` ``` convolution(Tensor input, Tensor weight, Tensor? bias, int[] stride, SymInt[] padding, int[] dilation, bool transposed, SymInt[] output_padding, int groups) -> Tensor ``` Example: notice the **None** argument in the following fx.node ``` convolution_default = torch.ops.aten.convolution.default(arg0, _param_constant0, None, [2, 2], [3, 3], [1, 1], False, [0, 0], 1) ``` would be exported as ``` Node( op='call_function', target='aten.convolution.default', args=[ Argument(as_tensor=TensorArgument(name='arg0')), Argument( as_tensor=TensorArgument(name='_param_constant0') ), Argument(as_none=True), Argument(as_ints=[2, 2]), Argument(as_ints=[3, 3]), Argument(as_ints=[1, 1]), Argument(as_bool=False), Argument(as_ints=[0, 0]), Argument(as_int=1) ], kwargs={}, outputs=[ ReturnArgument( as_tensor=TensorArgument(name='convolution_default') ) ], metadata='Skipped' ), ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/93210 Approved by: https://github.com/suo
Author
Committer
Parents
Loading