RuntimeError: Tensor.__contains__ only supports Tensor or scalar, but you passed in a <class 'function'> - Training RNN Lecture

On running eval(net, 1000, 3 , X_test, y_test)
I am getting this error :

    ---------------------------------------------------------------------------
    RuntimeError                              Traceback (most recent call last)
    <ipython-input-41-1411dd92e937> in <module>()
    ----> 1 eval(net, 1000 , 3, X_test, y_test)

    1 frames
    /usr/local/lib/python3.6/dist-packages/torch/tensor.py in __contains__(self, element)
        514         raise RuntimeError(
        515             "Tensor.__contains__ only supports Tensor or scalar, but you passed in a %s." %
    --> 516             type(element)
        517         )
        518 

    RuntimeError: Tensor.__contains__ only supports Tensor or scalar, but you passed in a <class 'function'>.

No clue what happened. Help!

Hi @Eeshaan_Jain,
Can you share your notebook?

Hey, apparently my input wasn’t a tensor but an array. It worked when I fixed it!

1 Like