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

Function _SparseMatMul

tensorflow/python/ops/math_grad.py:1612–1630  ·  view source on GitHub ↗

Helper function to create SparseMatMul op.

(t1, t2, out_dtype, transpose_a=False, transpose_b=False)

Source from the content-addressed store, hash-verified

1610 grad.op.type == "ReluGrad")
1611
1612 def _SparseMatMul(t1, t2, out_dtype, transpose_a=False, transpose_b=False):
1613 """Helper function to create SparseMatMul op."""
1614
1615 assert t1 in is_sparse and t2 in is_sparse
1616 t1_sparse = is_sparse[t1]
1617 t2_sparse = is_sparse[t2]
1618 if transpose_b:
1619 t2 = array_ops.transpose(t2)
1620 transpose_b = False
1621 prod = math_ops.matmul(
1622 t1,
1623 t2,
1624 transpose_a=transpose_a,
1625 transpose_b=transpose_b,
1626 a_is_sparse=t1_sparse,
1627 b_is_sparse=t2_sparse)
1628 if prod.dtype != out_dtype:
1629 prod = math_ops.cast(prod, out_dtype)
1630 return prod
1631
1632 dtype_a = op.inputs[0].dtype
1633 dtype_b = op.inputs[1].dtype

Callers 1

_SparseMatMulGradFunction · 0.85

Calls 3

transposeMethod · 0.80
matmulMethod · 0.45
castMethod · 0.45

Tested by

no test coverage detected