code: def remove_symbolic_reshape_block(block):
      num_changes = 0
      for op in list(block.operations):
          for b in op.blocks:
              num_changes += remove_symbolic_reshape_block(b)
          if op.op_type != "reshape":
              continue
          if op.shape.val is not None:
              # shape does not contain symbol.
              continue
          if op.shape.sym_val is None:
              # shape is runtime determined.
              continue
          # Use output shape as `shape`
          shape = op.outputs[0].shape
          if any_variadic(shape):
              msg = (
                  "Cannot reshape to variadic from a compile time "
                  + "shape argument. Variadic shape can only be achieved "
                  + "via runtime shape argument. op: {}"
              )
              raise ValueError(msg.format(op))
          num_symbols = num_symbolic(shape)
          if num_symbols > 1:
              continue
          # Convert the one symbol to -1
          integer_shape = [-1 if is_symbolic(i) else i for i in shape]
          with block:
              shape_const = mb.const(
                  val=integer_shape,
                  mode="immediate_value",
                  name=op.shape.name + "x",
                  before_op=op,
              )
              reshaped = mb.reshape(
                  x=op.x, shape=shape_const, name=op.name, before_op=op
              )
              op.enclosing_block.replace_uses_of_var_after_op(
                  anchor_op=op, old_var=op.outputs[0], new_var=reshaped
              )
              # Remove all the ops at once
              block.remove_ops([op, op.shape.op])
          num_changes += 1
      return num_changes
  
file_path: turicreate/src/external/coremltools_wrap/coremltools/coremltools/converters/mil/mil/passes/remove_symbolic_reshape.py
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import numpy
  from coremltools.converters.mil.mil.types.symbolic import is_symbolic, any_variadic, num_symbolic
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil.passes.pass_registry import register_pass
  import logging
label_desc: Use image node_id 1 for calling a global function with example usage: remove_symbolic_reshape_block(block) and returns: num_changes