docstr: Tests for the broadcast_dimension method.
  
  Verifies that:
  
  * `original.broadcast_dimension(axis, row_length) == broadcast`
  * `broadcast.broadcast_dimension(axis, row_length) == broadcast`
  * `broadcast.broadcast_dimension(axis, 1) == broadcast`
  
  Args:
    axis: The axis to broadcast
    row_length: The slice lengths to broadcast to.
    original_dim_sizes: The dimension sizes before broadcasting.
      original_dim_sizes[axis] should be equal to `1` or `row_length`.
    broadcast_dim_sizes: THe dimension sizes after broadcasting.
docstr_tok: ["Tests","for","the","broadcast_dimension","method",".","Verifies","that",":","*","`","original.broadcast_dimension","(","axis",",","row_length",")","==","broadcast","`","*","`","broadcast.broadcast_dimension","(","axis",",","row_length",")","==","broadcast","`","*","`","broadcast.broadcast_dimension","(","axis",",","1",")","==","broadcast","`","Args",":","axis",":","The","axis","to","broadcast","row_length",":","The","slice","lengths","to","broadcast","to",".","original_dim_sizes",":","The","dimension","sizes","before","broadcasting",".","original_dim_sizes","[","axis","]","should","be","equal","to","`","1","`","or","`","row_length","`",".","broadcast_dim_sizes",":","THe","dimension","sizes","after","broadcasting","."]
code: def testBroadcastDimension(
      self, axis, row_length, original_dim_sizes, broadcast_dim_sizes
  ):
      """Tests for the broadcast_dimension method.
  
      Verifies that:
  
      * `original.broadcast_dimension(axis, row_length) == broadcast`
      * `broadcast.broadcast_dimension(axis, row_length) == broadcast`
      * `broadcast.broadcast_dimension(axis, 1) == broadcast`
  
      Args:
        axis: The axis to broadcast
        row_length: The slice lengths to broadcast to.
        original_dim_sizes: The dimension sizes before broadcasting.
          original_dim_sizes[axis] should be equal to `1` or `row_length`.
        broadcast_dim_sizes: THe dimension sizes after broadcasting.
      """
      original_shape = RaggedTensorDynamicShape.from_dim_sizes(
          original_dim_sizes
      )
      bcast_shape = RaggedTensorDynamicShape.from_dim_sizes(
          broadcast_dim_sizes
      )
      self.assertEqual(original_shape.rank, bcast_shape.rank)
      # shape[axis].value == 1 and row_length > 1:
      bcast1 = original_shape.broadcast_dimension(axis, row_length)
      # shape[axis].value > 1 and row_length == shape[axis].value:
      bcast2 = bcast_shape.broadcast_dimension(axis, row_length)
      # shape[axis].value > 1 and row_length == 1:
      bcast3 = bcast_shape.broadcast_dimension(axis, 1)
  
      self.assertShapeEq(bcast1, bcast_shape)
      self.assertShapeEq(bcast2, bcast_shape)
      self.assertShapeEq(bcast3, bcast_shape)
  
file_path: tensorflow-upstream/tensorflow/python/ops/ragged/ragged_tensor_shape_test.py
imports: from absl.testing import parameterized
  import numpy
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops.ragged import ragged_factory_ops
  from tensorflow.python.ops.ragged import ragged_tensor
  from tensorflow.python.ops.ragged import ragged_tensor_shape
  from tensorflow.python.ops.ragged.ragged_tensor_shape import RaggedTensorDynamicShape
  from tensorflow.python.platform import googletest
label_desc: Use image node_id 4 for calling the RaggedTensorShapeTest obj's underlying member method code with example usage: obj.testBroadcastDimension(axis, row_length, original_dim_sizes, broadcast_dim_sizes) without return types