pytorch/test/quantization/serialized
Vasiliy Kuznetsov 3f5ea2367e Adding a version serialization type to ConvPackedParam (#43086)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/43086

This PR changes the format of `ConvPackedParam` in a nearly backwards-compatible way:
* a new format is introduced which has more flexibility and a lower on-disk size
* custom pickle functions are added to `ConvPackedParams` which know how to load the old format
* the custom pickle functions are **not** BC because the output type of `__getstate__` has changed.  We expect this to be acceptable as no user flows are actually broken (loading a v1 model with v2 code works), which is why we whitelist the failure.

Test plan (TODO finalize):

```
// adhoc testing of saving v1 and loading in v2: https://gist.github.com/vkuzo/f3616c5de1b3109cb2a1f504feed69be

// test that loading models with v1 conv params format works and leads to the same numerics
python test/test_quantization.py TestSerialization.test_conv2d_graph
python test/test_quantization.py TestSerialization.test_conv2d_nobias_graph

// test that saving and loading models with v2 conv params format works and leads to same numerics
python test/test_quantization.py TestSerialization.test_conv2d_graph_v2
python test/test_quantization.py TestSerialization.test_conv2d_nobias_graph_v2

// TODO before land:
// test numerics for a real model
// test legacy ONNX path
```

Note: this is a newer copy of https://github.com/pytorch/pytorch/pull/40003

Test Plan: Imported from OSS

Reviewed By: dreiss

Differential Revision: D23347832

Pulled By: vkuzo

fbshipit-source-id: 06bbe4666421ebad25dc54004c3b49a481d3cc92
2020-08-28 15:41:30 -07:00
..
TestSerialization.test_conv2d.expected.pt
TestSerialization.test_conv2d.input.pt
TestSerialization.test_conv2d.scripted.pt
TestSerialization.test_conv2d.state_dict.pt
TestSerialization.test_conv2d.traced.pt
TestSerialization.test_conv2d_graph.expected.pt
TestSerialization.test_conv2d_graph.input.pt
TestSerialization.test_conv2d_graph.scripted.pt
TestSerialization.test_conv2d_graph.traced.pt
TestSerialization.test_conv2d_graph_v2.expected.pt
TestSerialization.test_conv2d_graph_v2.input.pt
TestSerialization.test_conv2d_graph_v2.scripted.pt
TestSerialization.test_conv2d_graph_v2.traced.pt
TestSerialization.test_conv2d_nobias.expected.pt
TestSerialization.test_conv2d_nobias.input.pt
TestSerialization.test_conv2d_nobias.scripted.pt
TestSerialization.test_conv2d_nobias.state_dict.pt
TestSerialization.test_conv2d_nobias.traced.pt
TestSerialization.test_conv2d_nobias_graph.expected.pt
TestSerialization.test_conv2d_nobias_graph.input.pt
TestSerialization.test_conv2d_nobias_graph.scripted.pt
TestSerialization.test_conv2d_nobias_graph.traced.pt
TestSerialization.test_conv2d_nobias_graph_v2.expected.pt
TestSerialization.test_conv2d_nobias_graph_v2.input.pt
TestSerialization.test_conv2d_nobias_graph_v2.scripted.pt
TestSerialization.test_conv2d_nobias_graph_v2.traced.pt
TestSerialization.test_conv2d_relu.expected.pt
TestSerialization.test_conv2d_relu.input.pt
TestSerialization.test_conv2d_relu.scripted.pt
TestSerialization.test_conv2d_relu.state_dict.pt
TestSerialization.test_conv2d_relu.traced.pt
TestSerialization.test_conv3d.expected.pt
TestSerialization.test_conv3d.input.pt
TestSerialization.test_conv3d.scripted.pt
TestSerialization.test_conv3d.state_dict.pt
TestSerialization.test_conv3d.traced.pt
TestSerialization.test_conv3d_relu.expected.pt
TestSerialization.test_conv3d_relu.input.pt
TestSerialization.test_conv3d_relu.scripted.pt
TestSerialization.test_conv3d_relu.state_dict.pt
TestSerialization.test_conv3d_relu.traced.pt
TestSerialization.test_linear.expected.pt
TestSerialization.test_linear.input.pt
TestSerialization.test_linear.scripted.pt
TestSerialization.test_linear.state_dict.pt
TestSerialization.test_linear.traced.pt
TestSerialization.test_linear_dynamic_float16.expected.pt
TestSerialization.test_linear_dynamic_float16.input.pt
TestSerialization.test_linear_dynamic_float16.scripted.pt
TestSerialization.test_linear_dynamic_float16.state_dict.pt
TestSerialization.test_linear_dynamic_float16.traced.pt
TestSerialization.test_linear_dynamic_qint8.expected.pt
TestSerialization.test_linear_dynamic_qint8.input.pt
TestSerialization.test_linear_dynamic_qint8.scripted.pt
TestSerialization.test_linear_dynamic_qint8.state_dict.pt
TestSerialization.test_linear_dynamic_qint8.traced.pt
TestSerialization.test_linear_relu.expected.pt
TestSerialization.test_linear_relu.input.pt
TestSerialization.test_linear_relu.scripted.pt
TestSerialization.test_linear_relu.state_dict.pt
TestSerialization.test_linear_relu.traced.pt
TestSerialization.test_lstm.expected.pt
TestSerialization.test_lstm.input.pt
TestSerialization.test_lstm.scripted.pt
TestSerialization.test_lstm.state_dict.pt
TestSerialization.test_lstm.traced.pt