SIGN IN SIGN UP

Serialize NoneType as Null/None (#2445)

Summary:
Pull Request resolved: https://github.com/pytorch/executorch/pull/2445

For operators that have optional types such as [`aten.clamp.default`](https://github.com/pytorch/pytorch/blob/main/aten/src/ATen/native/native_functions.yaml#L1482), we obtain a `NoneType` if they are not specified.

Hence, we serialize `NoneType` as a `Null` type. Since the `NULL` keyword is reserved in C++, and the `None` keyword is reserved in Python, this leads to the usage of both names in our pipeline. Oh well.
```
NoneType -> create_null_value() -> GraphTypes.Null -> add_none_to_graph() -> add_none() -> TypeTag::NONE
```

Additionally, some nit reordering of functions and switch statements to roughly match [the schema order](https://github.com/pytorch/executorch/blob/main/backends/vulkan/serialization/schema.fbs#L67-L78).
```
union GraphTypes {
  Null,
  Int,
  Double,
  Bool,
  VkTensor,
  IntList,
  DoubleList,
  BoolList,
  ValueList,
  String,
}
```
ghstack-source-id: 219127763
exported-using-ghexport

Reviewed By: SS-JIA

Differential Revision: D54927551

fbshipit-source-id: c2effe6a8c0e089cb80c99172c2c0573f2b90e9a
J
Jorge Pineda committed
1ba14b962776136aa44c2ccfe3910e363ef1dd0a
Parent: 8b6f5d7
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> on 3/19/2024, 1:38:11 AM