docstr: Test that argument passing to conv1d is handled properly.
code: def testExpandedBatch(self):
      """Test that argument passing to conv1d is handled properly."""
      # double datatype is currently not supported for convolution ops
      # on the ROCm platform
      x = constant_op.constant([1, 2, 3, 4], dtype=dtypes.float32)
      x = array_ops.expand_dims(x, 0)  # Add batch dimension
      x = array_ops.expand_dims(x, 2)  # And depth dimension
      x = array_ops_stack.stack([x, x])  # Make batch shape [2, 1]
      filters = constant_op.constant([2, 1], dtype=dtypes.float32)
      filters = array_ops.expand_dims(filters, 1)  # in_channels
      filters = array_ops.expand_dims(filters, 2)  # out_channels
      # Filters is 2x1x1
      for stride in [1, 2]:
          with self.cached_session(use_gpu=test.is_gpu_available()):
              c = nn_ops.conv1d(x, filters, stride, padding="VALID")
              reduced = array_ops.squeeze(
                  c
              )  # Sequeeze out dims 1 and 3.
              output = self.evaluate(reduced)
              if stride == 1:
                  self.assertAllClose(
                      output,
                      [
                          [2 * 1 + 1 * 2, 2 * 2 + 1 * 3, 2 * 3 + 1 * 4],
                          [2 * 1 + 1 * 2, 2 * 2 + 1 * 3, 2 * 3 + 1 * 4],
                      ],
                  )
              else:
                  self.assertAllClose(
                      output,
                      [
                          [2 * 1 + 1 * 2, 2 * 3 + 1 * 4],
                          [2 * 1 + 1 * 2, 2 * 3 + 1 * 4],
                      ],
                  )
  
file_path: tensorflow-upstream/tensorflow/python/kernel_tests/nn_ops/conv1d_test.py
imports: import numpy
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import array_ops_stack
  from tensorflow.python.ops import nn_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 2 for calling the Conv1DTest obj's underlying member method code with example usage: obj.testExpandedBatch() without return types