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

Function _composite_impl

tensorflow/python/ops/linalg_ops.py:277–293  ·  view source on GitHub ↗

Composite implementation of matrix_solve_ls that supports GPU.

(matrix, rhs, l2_regularizer)

Source from the content-addressed store, hash-verified

275 return math_ops.matmul(matrix, cholesky_solve(chol, rhs), adjoint_a=True)
276
277 def _composite_impl(matrix, rhs, l2_regularizer):
278 """Composite implementation of matrix_solve_ls that supports GPU."""
279 with ops.name_scope(name, 'matrix_solve_ls', [matrix, rhs, l2_regularizer]):
280 matrix_shape = matrix.get_shape()[-2:]
281 if matrix_shape.is_fully_defined():
282 if matrix_shape[-2] >= matrix_shape[-1]:
283 return _overdetermined(matrix, rhs, l2_regularizer)
284 else:
285 return _underdetermined(matrix, rhs, l2_regularizer)
286 else:
287 # We have to defer determining the shape to runtime and use
288 # conditional execution of the appropriate graph.
289 matrix_shape = array_ops.shape(matrix)[-2:]
290 return control_flow_ops.cond(
291 matrix_shape[-2] >= matrix_shape[-1],
292 lambda: _overdetermined(matrix, rhs, l2_regularizer),
293 lambda: _underdetermined(matrix, rhs, l2_regularizer))
294
295 matrix = ops.convert_to_tensor(matrix, name='matrix')
296 if matrix.dtype == dtypes.complex128 and l2_regularizer != 0:

Callers 1

matrix_solve_lsFunction · 0.85

Calls 7

_overdeterminedFunction · 0.85
_underdeterminedFunction · 0.85
is_fully_definedMethod · 0.80
name_scopeMethod · 0.45
get_shapeMethod · 0.45
shapeMethod · 0.45
condMethod · 0.45

Tested by

no test coverage detected