(inp,
         fltr,
         window_strides,
         padding,
         dimension_numbers,
         filter_dilation=None)
return tf_np.asarray(
      tf.nn.convolution(
          input=inp,
          filters=fltr,
          padding=padding,
          strides=window_strides,
          dilations=filter_dilation,
          data_format=input_spec))
Convolution over an N-D array.

  See https://www.tensorflow.org/api_docs/python/tf/nn/convolution and
  https://www.tensorflow.org/xla/operation_semantics#conv_convolution for
  reference.

  Args:
    inp: an (N+2)-D array. The input of the convolution.
    fltr: an (N+2)-D array. The filter (i.e. kernel) of the convolution.
    window_strides: a sequence of N ints, the strides for moving the convolution
      window.
    padding: a string, either "VALID" or "SAME". The padding algorithm.
    dimension_numbers: a tuple of three strings encoding the data format of
      input, filter and output. "I" means input; "O" means output; "C" means
      channel; other characters such as "W", "H" and "D" means spatial
      dimensions.
    filter_dilation: the dilation rates for the filter. Dilating the filter
      means adding "holes" to the filter.

  Returns:
    An (N+2)-D array. The convolution result.
Convolution over an N-D array.
Convolution over an N - D array .
def conv(inp,
         fltr,
         window_strides,
         padding,
         dimension_numbers,
         filter_dilation=None):
  """Convolution over an N-D array.

  See https://www.tensorflow.org/api_docs/python/tf/nn/convolution and
  https://www.tensorflow.org/xla/operation_semantics#conv_convolution for
  reference.

  Args:
    inp: an (N+2)-D array. The input of the convolution.
    fltr: an (N+2)-D array. The filter (i.e. kernel) of the convolution.
    window_strides: a sequence of N ints, the strides for moving the convolution
      window.
    padding: a string, either "VALID" or "SAME". The padding algorithm.
    dimension_numbers: a tuple of three strings encoding the data format of
      input, filter and output. "I" means input; "O" means output; "C" means
      channel; other characters such as "W", "H" and "D" means spatial
      dimensions.
    filter_dilation: the dilation rates for the filter. Dilating the filter
      means adding "holes" to the filter.

  Returns:
    An (N+2)-D array. The convolution result.
  """
  input_spec, filter_spec, output_spec = dimension_numbers
  if input_spec != output_spec:
    raise ValueError("Input and output data formats must be the same; got %s "
                     "and %s" % (input_spec, output_spec))
  supported_filter_spec = ["WIO", "HWIO", "DHWIO"]
  if filter_spec not in supported_filter_spec:
    raise ValueError("The supported data format for the filter are %s; got %s" %
                     (supported_filter_spec, filter_spec))
  if input_spec[1:-1] != filter_spec[:-2]:
    raise ValueError("Input data format (%s) is not compatible with filter "
                     "data format (%s)" % (input_spec, filter_spec))
  # No type promotion in order to prevent accidentally doing more expensive
  # computation.
  dtype = tf_np.result_type(inp, fltr)
  inp = tf_np.asarray(inp, dtype)
  fltr = tf_np.asarray(fltr, dtype)
  return tf_np.asarray(
      tf.nn.convolution(
          input=inp,
          filters=fltr,
          padding=padding,
          strides=window_strides,
          dilations=filter_dilation,
          data_format=input_spec))
def conv ( inp , fltr , window_strides , padding , dimension_numbers , filter_dilation = None ) : input_spec , filter_spec , output_spec = dimension_numbers if input_spec != output_spec : raise ValueError ( "Input and output data formats must be the same; got %s " "and %s" % ( input_spec , output_spec ) ) supported_filter_spec = [ "WIO" , "HWIO" , "DHWIO" ] if filter_spec not in supported_filter_spec : raise ValueError ( "The supported data format for the filter are %s; got %s" % ( supported_filter_spec , filter_spec ) ) if input_spec [ 1 : - 1 ] != filter_spec [ : - 2 ] : raise ValueError ( "Input data format (%s) is not compatible with filter " "data format (%s)" % ( input_spec , filter_spec ) ) # No type promotion in order to prevent accidentally doing more expensive # computation. dtype = tf_np . result_type ( inp , fltr ) inp = tf_np . asarray ( inp , dtype ) fltr = tf_np . asarray ( fltr , dtype ) return tf_np . asarray ( tf . nn . convolution ( input = inp , filters = fltr , padding = padding , strides = window_strides , dilations = filter_dilation , data_format = input_spec ) )