mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Summary: There is a module called `2to3` which you can target for future specifically to remove these, the directory of `caffe2` has the most redundant imports: ```2to3 -f future -w caffe2``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/45033 Reviewed By: seemethere Differential Revision: D23808648 Pulled By: bugra fbshipit-source-id: 38971900f0fe43ab44a9168e57f2307580d36a38
25 lines
723 B
Python
25 lines
723 B
Python
|
|
|
|
|
|
|
|
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)
|