jiazhihao / TASO

The Tensor Algebra SuperOptimizer for Deep Learning
Apache License 2.0
692 stars 90 forks source link

output length mismatch and no attr #36

Open OuHangKresnik opened 4 years ago

OuHangKresnik commented 4 years ago

for op: input: "conv1" input: "Pad_pads" input: "Pad_value" output: "legacy_padded_tensor" name: "Pad" op_type: "Pad" domain: ""

Below assertion fails:

outputs = xf_operators[op.op_type](op, graph, tensors, model.graph.initializer) if not isinstance(outputs, list): outputs = [outputs] assert len(outputs) == len(op.output), "Number of output tensors mismatch"

and

def _pad(op, graph, tensors, initializer): inputs = _get_inputs(op, graph, tensors, initializer) attrs = _parse_attribute(op.attribute)

Currently treat pad as a no op

assert sum(attrs['pads']) == 0
return inputs

Because no attrs pads in this op

jiazhihao commented 4 years ago

@OuHangKresnik I pushed a temporary fix for this. The output shape of Pad depends on the second input tensor, so we will need the shape information from the ONNX runtime to calculate the exact output shape (which is a TODO item once we have the ONNX support).