syft.frameworks.torch.nn.rnn

Module Contents

class syft.frameworks.torch.nn.rnn.RNNCellBase(input_size, hidden_size, bias, num_chunks, nonlinearity=None)

Bases: torch.nn.Module

Cell to be used as base for all RNN cells, including GRU and LSTM This class overrides the torch.nn.RNNCellBase Only Linear and Dropout layers are used to be able to use MPC

reset_parameters(self)

This method initializes or reset all the parameters of the cell. The paramaters are initiated following a uniform distribution.

init_hidden(self, input)

This method initializes a hidden state when no hidden state is provided in the forward method. It creates a hidden state with zero values.

class syft.frameworks.torch.nn.rnn.RNNCell(input_size, hidden_size, bias=True, nonlinearity='tanh')

Bases: syft.frameworks.torch.nn.rnn.RNNCellBase

Python implementation of RNNCell with tanh or relu non-linearity for MPC This class overrides the torch.nn.RNNCell

forward(self, x, h=None)
class syft.frameworks.torch.nn.rnn.GRUCell(input_size, hidden_size, bias=True, nonlinearity=None)

Bases: syft.frameworks.torch.nn.rnn.RNNCellBase

Python implementation of GRUCell for MPC This class overrides the torch.nn.GRUCell

forward(self, x, h=None)
class syft.frameworks.torch.nn.rnn.LSTMCell(input_size, hidden_size, bias=True, nonlinearity=None)

Bases: syft.frameworks.torch.nn.rnn.RNNCellBase

Python implementation of LSTMCell for MPC This class overrides the torch.nn.LSTMCell

reset_parameters(self)
forward(self, x, hc=None)
class syft.frameworks.torch.nn.rnn.RNNBase(input_size, hidden_size, num_layers, bias, batch_first, dropout, bidirectional, base_cell, nonlinearity=None)

Bases: torch.nn.Module

Module to be used as base for all RNN modules, including GRU and LSTM This class overrides the torch.nn.RNNBase Only Linear and Dropout layers are used to be able to use MPC

forward(self, x, h=None)
_swap_axis(self, x, h)

This method swap the axes for batch_size and seq_len. It is used when batch_first==True.

_init_hidden(self, input)

This method initializes a hidden state when no hidden state is provided in the forward method. It creates a hidden state with zero values for each layer of the network.

_apply_time_step(self, x, h, c, t, reverse_direction=False)

Apply RNN layers at time t, given input and previous hidden states

class syft.frameworks.torch.nn.rnn.RNN(input_size, hidden_size, num_layers=1, nonlinearity='tanh', bias=True, batch_first=False, dropout=0, bidirectional=False)

Bases: syft.frameworks.torch.nn.rnn.RNNBase

Python implementation of RNN for MPC This class overrides the torch.nn.RNN

class syft.frameworks.torch.nn.rnn.GRU(input_size, hidden_size, num_layers=1, bias=True, batch_first=False, dropout=0, bidirectional=False)

Bases: syft.frameworks.torch.nn.rnn.RNNBase

Python implementation of GRU for MPC This class overrides the torch.nn.GRU

class syft.frameworks.torch.nn.rnn.LSTM(input_size, hidden_size, num_layers=1, bias=True, batch_first=False, dropout=0, bidirectional=False)

Bases: syft.frameworks.torch.nn.rnn.RNNBase

Python implementation of LSTM for MPC This class overrides the torch.nn.LSTM