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

Method trace

tensorflow/python/ops/linalg/linear_operator.py:996–1008  ·  view source on GitHub ↗

Trace of the linear operator, equal to sum of `self.diag_part()`. If the operator is square, this is also the sum of the eigenvalues. Args: name: A name for this `Op`. Returns: Shape `[B1,...,Bb]` `Tensor` of same `dtype` as `self`.

(self, name="trace")

Source from the content-addressed store, hash-verified

994 return math_ops.reduce_sum(self.diag_part(), axis=-1)
995
996 def trace(self, name="trace"):
997 """Trace of the linear operator, equal to sum of `self.diag_part()`.
998
999 If the operator is square, this is also the sum of the eigenvalues.
1000
1001 Args:
1002 name: A name for this `Op`.
1003
1004 Returns:
1005 Shape `[B1,...,Bb]` `Tensor` of same `dtype` as `self`.
1006 """
1007 with self._name_scope(name):
1008 return self._trace()
1009
1010 def _add_to_tensor(self, x):
1011 # Override if a more efficient implementation is available.

Callers 8

run_testMethod · 0.45
einsumFunction · 0.45
_diag_partMethod · 0.45
_traceMethod · 0.45
test_traceFunction · 0.45
_traceFunction · 0.45
_traceMethod · 0.45
_traceMethod · 0.45

Calls 2

_name_scopeMethod · 0.95
_traceMethod · 0.95

Tested by 2

run_testMethod · 0.36
test_traceFunction · 0.36