How to compare two symbols


#1

Hi,

I am trying to compare two sumbols using the “__eq(other)” function (https://mxnet.incubator.apache.org/api/python/symbol/symbol.html#mxnet.symbol.Symbol.eq) so here is an example for x and y symbols:

if x.__eq__(y):

I am getting a runtime error wirh message:

NotImplementedForSymbol: Function __bool__ (namely operator "bool") is not implemented for Symbol and only available in NDArray.

Any one has an idea of how to do this comparison the right way?


#2

Your if statement is not correct, because __eq__will return a Symbol and if cannot evaluate that. The following will work:

if x.__eq__(y).__bool__: