in onnxconverter_common/optimizer.py [0:0]
def find_push_down(node):
first_node_type = _nchw_input_node_type + _activation_node_type
if node.origin.op_type in first_node_type and len(node.successor) == 1 and node.successor[0] is not None:
pred_nchw = False
if node.origin.op_type in _activation_node_type:
for pred in node.precedence:
if pred.origin is not None and pred.origin.op_type in _nchw_input_node_type:
pred_nchw = True
break
if pred_nchw or node.origin.op_type in _nchw_input_node_type:
next = node.successor[0]
if next.origin is not None and next.origin.op_type == 'Transpose':
solution = PushTransposeSolution(node, next, next.successor, None)
return solution
if node.origin.op_type == 'Squeeze' and len(node.successor) == 1 and node.successor[0] is not None:
if node.precedence[0].origin is not None and node.precedence[0].origin.op_type == 'LSTM':
next = node.successor[0]
if next.origin is not None and next.origin.op_type == 'Transpose':
solution = PushTransposeSolution(node, next, next.successor, None)
return solution
return None