code: def remove_symbolic_reshape(prog):
      """
      Convert symbolic shape in `reshape` to integers.
  
      Given:
  
          main(%x: (s0, 4, fp32)) {
            block0() {
              %reshape_0_shape_0: (3,i32)^ = const(val=(s0, s1, 2))
              %reshape_0: (s0, 2, 2, fp32) = reshape(x=%x, shape=%reshape_0_shape_0)
            } -> (%reshape_0)
          }
  
      Result:
          main(%x: (s0, 4, fp32)) {
            block0() {
              %reshape_0_shape_0x: (3,i32)* = const(val=[-1, 2, 2])
              %reshape_0: (-1, 2, 2, fp32) = reshape(x=%x, shape=%reshape_0_shape_0x)
            } -> (%reshape_0)
          }
  
      Comment: Currently it does not perform any optimization, but simply
      replacing symbols with positive integer if solved from volumetric
      constraint, or -1. Therefore this pass fails if more than one symbols
      need to be resolve to -1.
  
      TODO (rdar://59165842): Use expand_dims, squeeze etc to use 0 instead
      of dynamic reshape with -1.
  
      Inputs:
  
          prog: Program
      """
      for f_name, f in prog.functions.items():
          num_changes = remove_symbolic_reshape_block(f)
          msg = "remove_symbolic_reshape: changed {} reshapes."
          logging.info(msg.format(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 2 for calling a global function with example usage: remove_symbolic_reshape(prog) without return types