未验证 提交 2958984a 编写于 作者: J Jason 提交者: GitHub

Merge pull request #330 from Channingss/tanh

paddle2onnx add op:tanh,clip,log
......@@ -68,6 +68,19 @@ class OpSet11(OpSet10):
mode=op.attr('mode'))
return [pads_node, constant_value_node, node]
def clip(self, op, block):
min_name = self.get_name(op.type, 'min')
max_name = self.get_name(op.type, 'max')
min_node = self.make_constant_node(min_name, onnx_pb.TensorProto.FLOAT,
op.attr('min'))
max_node = self.make_constant_node(max_name, onnx_pb.TensorProto.FLOAT,
op.attr('max'))
node = helper.make_node(
'Clip',
inputs=[op.input('X')[0], min_name, max_name],
outputs=op.output('Out'))
return [min_node, max_node, node]
def bilinear_interp(self, op, block):
input_names = op.input_names
coordinate_transformation_mode = ''
......
......@@ -110,11 +110,32 @@ class OpSet9(object):
'Relu', inputs=op.input('X'), outputs=op.output('Out'))
return node
def tanh(self, op, block):
node = helper.make_node(
'Tanh', inputs=op.input('X'), outputs=op.output('Out'))
return node
def log(self, op, block):
node = helper.make_node(
'Log', inputs=op.input('X'), outputs=op.output('Out'))
return node
def sigmoid(self, op, block):
node = helper.make_node(
'Sigmoid', inputs=op.input('X'), outputs=op.output('Out'))
return node
def clip(self, op, block):
min_value = op.attr('min')
max_value = op.attr('max')
node = helper.make_node(
'Clip',
inputs=[op.input('X')[0]],
outputs=op.output('Out'),
max=max_value,
min=min_value)
return node
def exp(self, op, block):
node = helper.make_node(
'Exp', inputs=op.input('X'), outputs=op.output('Out'))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册