Skip to content

Commit

Permalink
[2] Review comments handled
Browse files Browse the repository at this point in the history
  • Loading branch information
ANSHUMAN TRIPATHY authored and ANSHUMAN TRIPATHY committed Nov 2, 2020
1 parent 110f577 commit 2f63ba8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 7 additions & 2 deletions python/tvm/relay/frontend/tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -932,11 +932,16 @@ def _impl(inputs, attr, params, mod):
ret = _op.nn.sparse_dense(data, [weight_data, weight_indices, weight_indptrs])

# If both are true means First input was dense and second was sparse
# TODO: Support other adjoint option too
# TODO(ANSHUMAN87): Support other adjoint option too
if attr.get("adjoint_a") and attr.get("adjoint_b"):
ret = _op.transpose(ret)
else:
raise tvm.error.OpAttributeUnImplemented("Adjoint option is not supported yet.")
raise tvm.error.OpAttributeUnImplemented(
"Only tf.sparse.sparse_dense_matmul() with adjoint_a=True and adjoint_b=True"
" is supported, but adjoint_a={} and adjoint_b={} was supplied.".format(
attr.get("adjoint_a"), attr.get("adjoint_b")
)
)

return ret

Expand Down
6 changes: 3 additions & 3 deletions tests/python/frontend/tensorflow/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -1758,7 +1758,7 @@ def test_forward_batch_matmul():
def _test_sparse_dense_matmul(indices, values, A_shape, B_shape, dtype, flip=False):
""" One iteration of sparse_dense_matmul """

# TODO: Support adjoint options too
# TODO(ANSHUMAN87): Support adjoint options too
for adjoint_a in [False]:
for adjoint_b in [False]:
with tf.Graph().as_default():
Expand All @@ -1776,7 +1776,7 @@ def _test_sparse_dense_matmul(indices, values, A_shape, B_shape, dtype, flip=Fal

B_np = np.random.uniform(high=5.0, size=B_shape).astype(dtype)

# TODO: There is an issue in cuda scheduling for csr, work in progress
# TODO(ANSHUMAN87): There is an issue in cuda scheduling for csr, work in progress
compare_tf_with_tvm([B_np], [B.name], result.name, no_gpu=True)


Expand All @@ -1794,7 +1794,7 @@ def test_forward_sparse_dense_matmul():
#
# ------------------------------------------------------------------

# TODO: False case for flip need to be supported
# TODO(ANSHUMAN87): False case for flip need to be supported
# _test_sparse_dense_matmul([[0, 0], [1, 2]], [4.0, 8.0], [3, 4], [4, 3], "float32")
_test_sparse_dense_matmul([[0, 0], [1, 2]], [4.0, 8.0], [3, 5], [4, 3], "float32", True)
_test_sparse_dense_matmul([[0, 0], [1, 2]], [4.0, 8.0], [3, 3], [3, 3], "float32", True)
Expand Down

0 comments on commit 2f63ba8

Please sign in to comment.