torch-mlir/test/Dialect/Torch
Sean Silva d66e8fe1f8 Get simple quantized model importing.
This is enough to import the program and get it through the compilation
pipeline. It of course fails at the VerifyBackendContract pass since
there is a lot missing, but the final IR for a simple quantized MLP is
looking pretty decent already:
[IR](https://gist.github.com/silvasean/f76bccd76e9b193d396cfb2f9a11f54d)

Main changes:
- Add support for importing torch quantized tensors, including
  `torch.per_tensor_affine.create` op and `!torch.qint8` element type.
- Add support for importing `LinearPackedParamsBase` (basically a weight
  + optional bias, but requires `torch.linear_params.create` op +
  `!torch.LinearParams` type to model it). This was less painful than I
  expected, as it has the necessary methods to opaquely unpack itself. I
  factored things so it should be easy to extend to other custom classes
  like `ConvPackedParamsBase`.
- Add minimal boilerplate for importing `quantized::*` ops, with
  `quantized::linear` being a motivating example.
- Add e2e test with simple quantized MLP (courtesy of @phoenix-meadowlark).

This is somewhat of an abuse of `!numpy.ndarray` / `tensor`, as
really the proper semantics of `!torch.qint8` dtype on a Torch tensor is
"check the quantizer object of the tensor for side data (scale/offset,
possibly per-channel) that defines the full semantics of the tensor". We
don't have any such notion of "side data" for `!numpy.ndarray` /
`tensor`, let alone anything that would have the associated behavior of
keying off the dtype to determine if the side data is present.
This will be fixed by a proper `!torch.tensor` type.
2021-05-20 11:28:20 -07:00
..
GlobalizeObjectGraph Significantly restructure torch/aten import design. 2021-05-19 13:37:39 -07:00
adjust-calling-conventions.mlir Add torch-adjust-calling-conventions pass. 2021-04-05 17:56:35 -07:00
canonicalize.mlir Significantly restructure torch/aten import design. 2021-05-19 13:37:39 -07:00
inline-global-slots.mlir Add InlineGlobalSlots pass. 2021-04-27 12:18:54 -07:00
invalid.mlir Add basic MLP's to the e2e curriculum. 2021-04-27 12:18:54 -07:00
ops.mlir Get simple quantized model importing. 2021-05-20 11:28:20 -07:00
prepare-for-globalize-object-graph.mlir Support multiple instances of a class in GlobalizeObjectGraph. 2021-03-11 19:21:07 -08:00
reduce-op-variants.mlir Significantly restructure torch/aten import design. 2021-05-19 13:37:39 -07:00
refine-types.mlir Significantly restructure torch/aten import design. 2021-05-19 13:37:39 -07:00