Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
[2.0] Update Sparse Feature Related Error Message (#20402)
Browse files Browse the repository at this point in the history
* update error message

* update
  • Loading branch information
barry-jin authored Oct 19, 2021
1 parent 9e97732 commit caa2308
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/mxnet/gluon/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def _finish_deferred_init(self):
kwargs = {'shape': self.shape, 'dtype': self.dtype, 'ctx': context.cpu()}
if is_np_array():
if self._stype != 'default':
raise ValueError("mxnet.numpy.zeros does not support stype = {}"
raise ValueError("Currently stype {} is not supported in NumPy interface and Gluon2.0"
.format(self._stype))
zeros_fn = _mx_np.zeros
else:
Expand Down Expand Up @@ -384,7 +384,7 @@ def _init_grad(self):

if is_np_array():
if self._grad_stype != 'default':
raise ValueError("mxnet.numpy.zeros does not support stype = {}"
raise ValueError("Currently stype {} is not supported in NumPy interface and Gluon2.0"
.format(self._grad_stype))
self._grad = [_mx_np.zeros(shape=i.shape, dtype=i.dtype, ctx=i.ctx)
for i in self._data]
Expand Down
1 change: 1 addition & 0 deletions python/mxnet/ndarray/numpy_extension/_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,7 @@ def embedding(data, weight, input_dim=None, output_dim=None, dtype="float32", sp
"""
assert input_dim > 0, "Vocabulary size of the input indices should be greater than 0."
assert output_dim > 0, "Dimension of the embedding vectors should greater than 0."
assert not sparse_grad, "Currently row sparse gradient is not supported in npx.embedding"
return _api_internal.embedding(data, weight, input_dim, output_dim, dtype, sparse_grad)


Expand Down

0 comments on commit caa2308

Please sign in to comment.