parameters: (
      network: TRTNetwork,
      a: TRTTensor,
      b: TRTTensor,
      a_name: str,
      b_name: str,
      preset_diff: int = 0
  )
return_statement: return a, b
docstring: Broadcast two TensorRT tensors to the same number of dimensions by
      prepending 1s to the tensor with less number of dimensions.
  
      Args:
          network (TRTNetwork): TensorRT network object.
          a (TRTTensor): A TensorRT ITensor.
          b (TRTTensor): A TensorRT ITensor.
          a_name (str): Name of tensor a.
          b_name (str): Name of tensor b.
          preset_diff (int): The difference of number of dimensions after broadcast.
              A positive number means after broadcast, tensor `a` would have `preset_diff`
              more dimensions than `b`. This is used in matmul, since we need to broadcast
              tensors but not always to the same number of dimension. The reason is that
              matmul supports Matrix x Vector and in this case broadcasted vector should
              have 1 less number of dimensions than the matrix tensor.
  
      Returns:
          Two TensorRT ITensors that are broadcasted to the same number of dimensions.
docstring_summary: Broadcast two TensorRT tensors to the same number of dimensions by
      prepending 1s to the tensor with less number of dimensions.
docstring_tokens: Broadcast two TensorRT tensors to the same number of dimensions by prepending 1s to the tensor with less number of dimensions .
function: def broadcast(
      network: TRTNetwork,
      a: TRTTensor,
      b: TRTTensor,
      a_name: str,
      b_name: str,
      preset_diff: int = 0
  ) -> Tuple[TRTTensor, TRTTensor]:
      """
      Broadcast two TensorRT tensors to the same number of dimensions by
      prepending 1s to the tensor with less number of dimensions.
  
      Args:
          network (TRTNetwork): TensorRT network object.
          a (TRTTensor): A TensorRT ITensor.
          b (TRTTensor): A TensorRT ITensor.
          a_name (str): Name of tensor a.
          b_name (str): Name of tensor b.
          preset_diff (int): The difference of number of dimensions after broadcast.
              A positive number means after broadcast, tensor `a` would have `preset_diff`
              more dimensions than `b`. This is used in matmul, since we need to broadcast
              tensors but not always to the same number of dimension. The reason is that
              matmul supports Matrix x Vector and in this case broadcasted vector should
              have 1 less number of dimensions than the matrix tensor.
  
      Returns:
          Two TensorRT ITensors that are broadcasted to the same number of dimensions.
      """
      a_shape = tuple(a.shape)
      b_shape = tuple(b.shape)
  
      diff = len(a_shape) - len(b_shape) - preset_diff
      if diff > 0:
          b = prepend_ones(network, b, f"{b_name}_broadcast", diff)
      elif diff < 0:
          a = prepend_ones(network, a, f"{a_name}_broadcast", -diff)
  
      return a, b
function_tokens: def broadcast ( network : TRTNetwork , a : TRTTensor , b : TRTTensor , a_name : str , b_name : str , preset_diff : int = 0 ) -> Tuple [ TRTTensor , TRTTensor ] : a_shape = tuple ( a . shape ) b_shape = tuple ( b . shape ) diff = len ( a_shape ) - len ( b_shape ) - preset_diff if diff > 0 : b = prepend_ones ( network , b , f"{b_name}_broadcast" , diff ) elif diff < 0 : a = prepend_ones ( network , a , f"{a_name}_broadcast" , - diff ) return a , b