зеркало из https://github.com/microsoft/MMdnn.git
ONNX emitter support op Relu6 and DepthwiseConv
This commit is contained in:
Родитель
af8e89fc79
Коммит
b11412432e
|
@ -139,6 +139,9 @@ def KitModel(weight_file = None):
|
|||
kernel_shape = list(IR_node.get_attr('kernel_shape'))[:-2]
|
||||
dilations = list(IR_node.get_attr('dilations', [1] * (len(kernel_shape) + 2)))[1:-1]
|
||||
group = IR_node.get_attr('group', 1)
|
||||
if IR_node.type == 'DepthwiseConv':
|
||||
group = IR_node.IR_layer.attr["kernel_shape"].list.i[-2]
|
||||
self.weights_dict[IR_node.name]['weights'] = np.swapaxes(self.weights_dict[IR_node.name]['weights'], -1, -2)
|
||||
pads = IR_node.get_attr('pads')
|
||||
pad_length = len(pads)
|
||||
pads = pads[1:pad_length // 2 - 1] + pads[pad_length // 2 + 1:pad_length - 1]
|
||||
|
@ -462,5 +465,15 @@ def KitModel(weight_file = None):
|
|||
size))
|
||||
self.nodes.append(IR_node.variable_name)
|
||||
|
||||
def emit_Relu6(self, IR_node):
|
||||
self.add_body(1, "{:15} = helper.make_node('Clip', inputs=['{}'], outputs=['{}'], min=0.0, max=6.0)".format(
|
||||
IR_node.variable_name,
|
||||
self.parent_variable_name(IR_node),
|
||||
IR_node.variable_name))
|
||||
self.nodes.append(IR_node.variable_name)
|
||||
|
||||
def emit_DepthwiseConv(self, IR_node):
|
||||
self.emit_Conv(IR_node)
|
||||
|
||||
def emit_UNKNOWN(self, IR_node):
|
||||
print(IR_node.IR_layer.name)
|
||||
|
|
Загрузка…
Ссылка в новой задаче