code: def _fuse_dilation_conv(gddict):
      """
      A dilated convolution in older tensorflow versions might not be fused in the
      Conv2D or DepthwiseConv2D op, but represented with the following format:
  
          SpaceToBatchND -> (Depthwise)Conv2D -> BatchToSpaceND
  
      We try to fuse it back into (Depthwise)Conv2D with the dilation parameter
      set in attribute.
      There are several patterns that exist in tensorflow for breaking up dilation
      convolutions. We detect the following patterns:
  
        SpaceToBatchND -> ExpandDims -> Conv2D -> Squeeze -> BatchToSpaceND
  
        SpaceToBatchND -> Conv2D -> BatchToSpaceND
  
      The first case appears when Conv1D is used, TF expands/squeeze the inputs to
      conform Conv2D pattern.
      The second case is a basic Conv2D pattern.
  
      """
      for name in list(gddict.keys()):
          if name not in gddict:
              # Node might have been removed from graph during fusion.
              continue
          node = gddict[name]
          if node.op in {"Conv2D", "DepthwiseConv2dNative"}:
              _pattern_match_and_rewrite(gddict, name)
  
file_path: turicreate/src/external/coremltools_wrap/coremltools/coremltools/converters/mil/frontend/tensorflow/tf_graph_pass/fuse_dilation_conv.py
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import numpy
  from coremltools.converters.mil.mil import types
  from ..parsed_tf_node import ParsedTFNode
  from ..basic_graph_ops import replace_source, delete_node
label_desc: Use image node_id 3 for calling a global function with example usage: _fuse_dilation_conv(gddict) without return types