Download lib/python3.9/site-packages/caffe2/python/test/fakefp16_transform_test.py from camenduru/slahmr-test: direct link, hf CLI and curl.
- Browser
- Download file 723 Bytes
-
https://huggingface.co/camenduru/slahmr-test/resolve/main/lib/python3.9/site-packages/caffe2/python/test/fakefp16_transform_test.py
- Command line
-
hf download hf://camenduru/slahmr-test/lib/python3.9/site-packages/caffe2/python/test/fakefp16_transform_test.py
-
curl -L -o fakefp16_transform_test.py https://huggingface.co/camenduru/slahmr-test/resolve/main/lib/python3.9/site-packages/caffe2/python/test/fakefp16_transform_test.py
723 Bytes
| import unittest | |
| from caffe2.python.fakefp16_transform_lib import fakeFp16FuseOps | |
| from caffe2.python import core | |
| class Transformer(unittest.TestCase): | |
| def test_fuse(self): | |
| net_swish = core.Net("test_swish") | |
| net_swish_init = core.Net("test_swish_init") | |
| deq = core.CreateOperator("Int8DequantizeNNPI", ["Xq"], ["X"]) | |
| swish = core.CreateOperator("SwishFakeFp16NNPI", ["X"], ["Y"]) | |
| quant = core.CreateOperator("Int8QuantizeNNPI", ["Y"], ["Y_q"]) | |
| net_swish.Proto().op.extend( | |
| [ | |
| deq, swish, quant | |
| ] | |
| ) | |
| print(net_swish.Proto()) | |
| out_net = fakeFp16FuseOps(net_swish.Proto()) | |
| assert(len(out_net.op) == 1) | |