Variable Can not compare with other parameter?

When I try to find out some Variable result who is the biggest. However, I found that “Variable” can not compare with other parameters, such as ndarray or FloatTensor. Thus, is there any thing wrong with Variable, or what should I do?

What are you trying to do? Comparison operators are broken on Variables right now (there’s already an issue on that), but all this should be achievable with regular methods too (e.g. eg, ne, le, gt, etc.).

Oh, thanks. Maybe there is another way to solve this problem for transforming Variable into Ndarray. However, I think to use comparison operators for variable is more convenient.

@cumttang, if you want to convert your Variable v into a ndarray you can type v.data.numpy().
If you simply want to compare it with a FloatTensor you can use v.data.

1 Like

Thanks a lot!:grinning: