Error when trying to use _VF.vf.lsm()

Hello, I am trying to use a functional lstm for a few shot learning project. I saw from this post (Torch.nn.functional.lstm) that we could use _VF.lstm(). However, when trying to run it with the following parameters I get an error.

I am not sure how tuple of Tenors is different from a tuple containing tensors. Furthermore, from the source code found here (pytorch/rnn.py at master · pytorch/pytorch · GitHub), setting hx=None for the parameter right after the input is the default value. However, I get an error telling me I forgot a parameter when I don’t set it.

data = train_loader.__iter__().next()
inputs, labels = data

#get model parameters
fast_weights = dict((name, param) for (name, param) in model.named_parameters())

#get the lstm specific parameters
lstm_params = [tensor for key, tensor in fast_weights.items() if key not in ['embedding.weight', 'linear.weight', 'linear.bias']]
lstm_params = tuple(lstm_params)

#try to run _VF.vf.lstm()
lstm = torch.nn.modules.rnn._VF.vf.lstm(inputs, None, lstm_params, True, 2, 0.2, True, True, True)

Error:
TypeError: lstm() received an invalid combination of arguments - got (Tensor, NoneType, tuple, bool, int, float, bool, bool, bool), but expected one of:

  • (Tensor data, Tensor batch_sizes, tuple of Tensors hx, tuple of Tensors params, bool has_biases, int num_layers, float dropout, bool train, bool bidirectional)
    didn’t match because some of the arguments have invalid types: (Tensor, !NoneType!, !tuple!, !bool!, !int!, !float!, !bool!, bool, bool)
  • (Tensor input, tuple of Tensors hx, tuple of Tensors params, bool has_biases, int num_layers, float dropout, bool train, bool bidirectional, bool batch_first)
    didn’t match because some of the arguments have invalid types: (Tensor, !NoneType!, !tuple!, bool, int, float, bool, bool, bool)