pytorch/caffe2/python/fakefp16_transform_lib.py
Hector Yuen c8e789e06e add fake fp16 fusions to net transforms (#42927)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/42927

added fp16 fusion to net transforms
refactored the transforms as well as glow_transform to get out of opt/custom so that the OSS builds passed

Test Plan: added net runner tests for this

Reviewed By: yinghai

Differential Revision: D23080881

fbshipit-source-id: ee6451811fedfd07c6560c178229854bca29301f
2020-08-14 13:30:27 -07:00

16 lines
429 B
Python

#!/usr/bin/env python3
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import caffe2.python._import_c_extension as C
from caffe2.proto.caffe2_pb2 import NetDef
def fakeFp16FuseOps(net : NetDef) -> NetDef:
net_str = net.SerializeToString()
out_str = C.fakeFp16FuseOps(net_str)
out_net = NetDef()
out_net.ParseFromString(out_str)
return out_net