parameters: (self, matrix, min_rank, event_ndims)
return_statement: return array_ops.reshape(matrix, pad)
docstring: Helper to __init__ which gets matrix in batch-ready form.
docstring_summary: Helper to __init__ which gets matrix in batch-ready form.
docstring_tokens: Helper to __init__ which gets matrix in batch - ready form .
function: def _process_matrix(self, matrix, min_rank, event_ndims):
      """Helper to __init__ which gets matrix in batch-ready form."""
      # Pad the matrix so that matmul works in the case of a matrix and vector
      # input. Keep track if the matrix was padded, to distinguish between a
      # rank 3 tensor and a padded rank 2 tensor.
      # TODO(srvasude): Remove side-effects from functions. Its currently unbroken
      # but error-prone since the function call order may change in the future.
      self._rank_two_event_ndims_one = math_ops.logical_and(
          math_ops.equal(array_ops.rank(matrix), min_rank),
          math_ops.equal(event_ndims, 1))
      left = array_ops.where(self._rank_two_event_ndims_one, 1, 0)
      pad = array_ops.concat(
          [array_ops.ones(
              [left], dtype=dtypes.int32), array_ops.shape(matrix)],
          0)
      return array_ops.reshape(matrix, pad)
function_tokens: def _process_matrix ( self , matrix , min_rank , event_ndims ) : # Pad the matrix so that matmul works in the case of a matrix and vector # input. Keep track if the matrix was padded, to distinguish between a # rank 3 tensor and a padded rank 2 tensor. # TODO(srvasude): Remove side-effects from functions. Its currently unbroken # but error-prone since the function call order may change in the future. self . _rank_two_event_ndims_one = math_ops . logical_and ( math_ops . equal ( array_ops . rank ( matrix ) , min_rank ) , math_ops . equal ( event_ndims , 1 ) ) left = array_ops . where ( self . _rank_two_event_ndims_one , 1 , 0 ) pad = array_ops . concat ( [ array_ops . ones ( [ left ] , dtype = dtypes . int32 ) , array_ops . shape ( matrix ) ] , 0 ) return array_ops . reshape ( matrix , pad )