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

[Numpy] Unique has not registered the gradient #18074

@sxjscience

Description

@sxjscience
import mxnet as mx
from mxnet.gluon import nn, HybridBlock
mx.npx.set_np()

class Foo(HybridBlock):
    def hybrid_forward(self, F, x):
        y = F.np.unique(x)
        return y

foo = Foo()
foo.hybridize()
out = foo(mx.np.ones((10,)))
print(out.asnumpy())

Error message:

MXNetError: Traceback (most recent call last):
  File "../src/nnvm/gradient.cc", line 213
MXNetError: Operator _npi_unique is non-differentiable because it didn't register FGradient attribute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions