Skip to content

use tf.shape instead of .shape for dynamic axes in InstanceNormalization #771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: main
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
4 changes: 2 additions & 2 deletions onnx_tf/handlers/backend/instance_normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from onnx_tf.handlers.backend_handler import BackendHandler
from onnx_tf.handlers.handler import onnx_op
from onnx_tf.handlers.handler import tf_func

from onnx_tf.common.tf_helper import tf_shape

@onnx_op("InstanceNormalization")
@tf_func(tf.nn.batch_normalization)
Expand Down Expand Up @@ -31,7 +31,7 @@ def _common(cls, node, **kwargs):
beta = tensor_dict[node.inputs[2]]

inputs = tensor_dict[node.inputs[0]]
inputs_shape = inputs.shape
inputs_shape = tf_shape(inputs)
inputs_rank = inputs.shape.ndims

moments_axes = list(range(inputs_rank))[2:]
Expand Down