neuromancer.modules.rnn module

class neuromancer.modules.rnn.RNN(input_size, hsizes=(16, ), bias=False, nonlin=<class 'torch.nn.modules.activation.GELU'>, linear_map=<class 'neuromancer.slim.linear.Linear'>, linargs={})[source]

Bases: Module

forward(sequence, init_states=None)[source]
Parameters:
  • sequence – a tensor(s) of shape (seq_len, batch, input_size)

  • init_state – h_0 (num_layers, batch, hidden_size)

Returns:

  • output: (seq_len, batch, hidden_size)

  • h_n: (num_layers, batch, hidden_size)

reg_error()[source]
class neuromancer.modules.rnn.RNNCell(input_size, hidden_size, bias=False, nonlin=<class 'torch.nn.modules.activation.GELU'>, linear_map=<class 'neuromancer.slim.linear.Linear'>, linargs={})[source]

Bases: Module

forward(input, hidden)[source]
Parameters:
  • input – (torch.Tensor, shape=[batchsize, input_size])

  • hidden – (torch.Tensor, shape=[batchsize, hidden_size])

Returns:

(torch.Tensor, shape=[batchsize, hidden_size])

reg_error()[source]