Take a look at this please:

  
      github.com
  
  
    IBM/pytorch-seq2seq/blob/master/seq2seq/models/DecoderRNN.py 207
import random

import numpy as np

import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F

from .attention import Attention
from .baseRNN import BaseRNN

if torch.cuda.is_available():
    import torch.cuda as device
else:
    import torch as device


class DecoderRNN(BaseRNN):
    r"""


  This file has been truncated. show original

  
  
    
    
  
  


I am not sure why you are having that problem, but please check the type of your input to lstm.