MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _maybe_validate_matrix

Function _maybe_validate_matrix

tensorflow/python/ops/linalg/linalg_impl.py:642–656  ·  view source on GitHub ↗

Checks that input is a `float` matrix.

(a, validate_args)

Source from the content-addressed store, hash-verified

640
641
642def _maybe_validate_matrix(a, validate_args):
643 """Checks that input is a `float` matrix."""
644 assertions = []
645 if not a.dtype.is_floating:
646 raise TypeError('Input `a` must have `float`-like `dtype` '
647 '(saw {}).'.format(a.dtype.name))
648 if a.shape is not None and a.shape.rank is not None:
649 if a.shape.rank < 2:
650 raise ValueError('Input `a` must have at least 2 dimensions '
651 '(saw: {}).'.format(a.shape.rank))
652 elif validate_args:
653 assertions.append(
654 check_ops.assert_rank_at_least(
655 a, rank=2, message='Input `a` must have at least 2 dimensions.'))
656 return assertions
657
658
659@tf_export('linalg.matrix_rank')

Callers 2

matrix_rankFunction · 0.85
pinvFunction · 0.85

Calls 2

formatMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected