Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Conv conversion: infer rank from weights if possible #558

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions onnx_coreml/_operators_nd.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ def load_input_constants(builder, node, graph, err):
def _add_conv_like_op(add_func, get_params_func, params_dict,
builder, node, graph, err):

# To do: Need to avoid dependence on rank for conversion since rank is not always available.
rank = builder._get_rank(node.inputs[0])

if rank < 0 and node.op_type == "Conv" and "w_shape" in params_dict:
rank = len(params_dict["w_shape"])

if rank == 4:
get_params_func(builder, node, graph, err, params_dict)
add_func(node.inputs, node.outputs, params_dict=params_dict, builder=builder, node=node, graph=graph, err=err)
Expand Down