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

Function _MatMulGradAgainstFirstOnly

tensorflow/python/ops/math_grad.py:1534–1547  ·  view source on GitHub ↗

Gradient for MatMul, only for the first input.

(op, grad)

Source from the content-addressed store, hash-verified

1532
1533
1534def _MatMulGradAgainstFirstOnly(op, grad):
1535 """Gradient for MatMul, only for the first input."""
1536 t_a = op.get_attr("transpose_a")
1537 t_b = op.get_attr("transpose_b")
1538 b = math_ops.conj(op.inputs[1])
1539 if not t_a and not t_b:
1540 grad_a = gen_math_ops.mat_mul(grad, b, transpose_b=True)
1541 elif not t_a and t_b:
1542 grad_a = gen_math_ops.mat_mul(grad, b)
1543 elif t_a and not t_b:
1544 grad_a = gen_math_ops.mat_mul(b, grad, transpose_b=True)
1545 elif t_a and t_b:
1546 grad_a = gen_math_ops.mat_mul(b, grad, transpose_a=True, transpose_b=True)
1547 return grad_a, None
1548
1549
1550def _MatMulGradAgainstSecondOnly(op, grad):

Callers 1

_MatMulGradFunction · 0.85

Calls 1

get_attrMethod · 0.45

Tested by

no test coverage detected