parameters: (self, mu)
docstring: Return `mu` after validity checks and possibly with assertations.
docstring_summary: Return `mu` after validity checks and possibly with assertations.
docstring_tokens: Return mu after validity checks and possibly with assertations .
function: def _check_mu(self, mu):
      """Return `mu` after validity checks and possibly with assertations."""
      mu = ops.convert_to_tensor(mu)
      cov = self._cov
  
      if mu.dtype != cov.dtype:
        raise TypeError(
            "mu and cov must have the same dtype.  Found mu.dtype = %s, "
            "cov.dtype = %s"
            % (mu.dtype, cov.dtype))
  
      # Try to validate with static checks.
      mu_shape = mu.get_shape()
      cov_shape = cov.get_shape()
      if mu_shape.is_fully_defined() and cov_shape.is_fully_defined():
        if mu_shape != cov_shape[:-1]:
          raise ValueError(
              "mu.shape and cov.shape[:-1] should match.  Found: mu.shape=%s, "
              "cov.shape=%s" % (mu_shape, cov_shape))
        else:
          return mu
  
      # Static checks could not be run, so possibly do dynamic checks.
      if not self.validate_args:
        return mu
      else:
        assert_same_rank = check_ops.assert_equal(
            array_ops.rank(mu) + 1,
            cov.rank(),
            data=["mu should have rank 1 less than cov.  Found: rank(mu) = ",
                  array_ops.rank(mu), " rank(cov) = ", cov.rank()],
        )
        with ops.control_dependencies([assert_same_rank]):
          assert_same_shape = check_ops.assert_equal(
              array_ops.shape(mu),
              cov.vector_shape(),
              data=["mu.shape and cov.shape[:-1] should match.  "
                    "Found: shape(mu) = "
                    , array_ops.shape(mu), " shape(cov) = ", cov.shape()],
          )
          return control_flow_ops.with_dependencies([assert_same_shape], mu)
function_tokens: def _check_mu ( self , mu ) : mu = ops . convert_to_tensor ( mu ) cov = self . _cov if mu . dtype != cov . dtype : raise TypeError ( "mu and cov must have the same dtype.  Found mu.dtype = %s, " "cov.dtype = %s" % ( mu . dtype , cov . dtype ) ) # Try to validate with static checks. mu_shape = mu . get_shape ( ) cov_shape = cov . get_shape ( ) if mu_shape . is_fully_defined ( ) and cov_shape . is_fully_defined ( ) : if mu_shape != cov_shape [ : - 1 ] : raise ValueError ( "mu.shape and cov.shape[:-1] should match.  Found: mu.shape=%s, " "cov.shape=%s" % ( mu_shape , cov_shape ) ) else : return mu # Static checks could not be run, so possibly do dynamic checks. if not self . validate_args : return mu else : assert_same_rank = check_ops . assert_equal ( array_ops . rank ( mu ) + 1 , cov . rank ( ) , data = [ "mu should have rank 1 less than cov.  Found: rank(mu) = " , array_ops . rank ( mu ) , " rank(cov) = " , cov . rank ( ) ] , ) with ops . control_dependencies ( [ assert_same_rank ] ) : assert_same_shape = check_ops . assert_equal ( array_ops . shape ( mu ) , cov . vector_shape ( ) , data = [ "mu.shape and cov.shape[:-1] should match.  " "Found: shape(mu) = " , array_ops . shape ( mu ) , " shape(cov) = " , cov . shape ( ) ] , ) return control_flow_ops . with_dependencies ( [ assert_same_shape ] , mu )