parameters: (self, shape)
docstring: Check that the init arg `shape` defines a valid operator.
docstring_summary: Check that the init arg `shape` defines a valid operator.
docstring_tokens: Check that the init arg shape defines a valid operator .
function: def _check_shape(self, shape):
      """Check that the init arg `shape` defines a valid operator."""
      shape = ops.convert_to_tensor(shape, name="shape")
      if not self._verify_pd:
        return shape
  
      # Further checks are equivalent to verification that this is positive
      # definite.  Why?  Because the further checks simply check that this is a
      # square matrix, and combining the fact that this is square (and thus maps
      # a vector space R^k onto itself), with the behavior of .matmul(), this must
      # be the identity operator.
      rank = array_ops.size(shape)
      assert_matrix = check_ops.assert_less_equal(2, rank)
      with ops.control_dependencies([assert_matrix]):
        last_dim = array_ops.gather(shape, rank - 1)
        second_to_last_dim = array_ops.gather(shape, rank - 2)
        assert_square = check_ops.assert_equal(last_dim, second_to_last_dim)
        return control_flow_ops.with_dependencies([assert_matrix, assert_square],
                                                  shape)
function_tokens: def _check_shape ( self , shape ) : shape = ops . convert_to_tensor ( shape , name = "shape" ) if not self . _verify_pd : return shape # Further checks are equivalent to verification that this is positive # definite.  Why?  Because the further checks simply check that this is a # square matrix, and combining the fact that this is square (and thus maps # a vector space R^k onto itself), with the behavior of .matmul(), this must # be the identity operator. rank = array_ops . size ( shape ) assert_matrix = check_ops . assert_less_equal ( 2 , rank ) with ops . control_dependencies ( [ assert_matrix ] ) : last_dim = array_ops . gather ( shape , rank - 1 ) second_to_last_dim = array_ops . gather ( shape , rank - 2 ) assert_square = check_ops . assert_equal ( last_dim , second_to_last_dim ) return control_flow_ops . with_dependencies ( [ assert_matrix , assert_square ] , shape )