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

Function _MatMulGradAgainstSecondOnly

tensorflow/python/ops/math_grad.py:1550–1563  ·  view source on GitHub ↗

Gradient for MatMul, only for the second input.

(op, grad)

Source from the content-addressed store, hash-verified

1548
1549
1550def _MatMulGradAgainstSecondOnly(op, grad):
1551 """Gradient for MatMul, only for the second input."""
1552 t_a = op.get_attr("transpose_a")
1553 t_b = op.get_attr("transpose_b")
1554 a = math_ops.conj(op.inputs[0])
1555 if not t_a and not t_b:
1556 grad_b = gen_math_ops.mat_mul(a, grad, transpose_a=True)
1557 elif not t_a and t_b:
1558 grad_b = gen_math_ops.mat_mul(grad, a, transpose_a=True)
1559 elif t_a and not t_b:
1560 grad_b = gen_math_ops.mat_mul(a, grad)
1561 elif t_a and t_b:
1562 grad_b = gen_math_ops.mat_mul(grad, a, transpose_a=True, transpose_b=True)
1563 return None, grad_b
1564
1565
1566@ops.RegisterGradient("MatMul")

Callers 1

_MatMulGradFunction · 0.85

Calls 1

get_attrMethod · 0.45

Tested by

no test coverage detected