16 from __future__
import absolute_import
17 from __future__
import division
18 from __future__
import print_function
19 from __future__
import unicode_literals
29 def runTransform(cls, transform_name, net):
30 pb = net.Proto().SerializeToString()
31 if C.transform_exists(transform_name):
32 output = C.run_transform(transform_name, pb)
33 elif C.workspace_transform_exists(transform_name):
34 output = C.run_workspace_transform(transform_name, pb)
36 raise AttributeError(
'Transformation {} not found.'.format(transform_name))
37 net.Proto().ParseFromString(output)
39 def __getattr__(self, transform_name):
40 return lambda net : self.
runTransform(transform_name, net)
43 def fuseNNPACKConvRelu(net):
44 net.Proto().ParseFromString(
45 C.transform_fuseNNPACKConvRelu(net.Proto().SerializeToString())
49 def optimizeForIDEEP(net, training_mode = False):
50 net.Proto().ParseFromString(
51 C.transform_optimizeForIDEEP(net.Proto().SerializeToString(), training_mode)
56 net.Proto().ParseFromString(
57 C.transform_fuseConvBN(net.Proto().SerializeToString())