syft.frameworks.torch.nn

Package Contents

class syft.frameworks.torch.nn.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.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.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

class syft.frameworks.torch.nn.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.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.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.Conv2d(in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=False, padding_mode='zeros')

Bases: torch.nn.Module

This class is the beginning of an exact python port of the torch.nn.Conv2d module. Because PySyft cannot hook into layers which are implemented in C++, our special functionalities (such as encrypted computation) do not work with torch.nn.Conv2d and so we must have python ports available for all layer types which we seek to use.

Note that this module has been tested to ensure that it outputs the exact output values that the main module outputs in the same order that the main module does.

However, there is often some rounding error of unknown origin, usually less than 1e-6 in magnitude.

This module has not yet been tested with GPUs but should work out of the box.

forward(self, data)
class syft.frameworks.torch.nn.AvgPool2d(kernel_size, stride=None, padding=0, ceil_mode=False, count_include_pad=True, divisor_override=None)

Bases: torch.nn.Module

This class is the beginning of an exact python port of the torch.nn.AvgPool2d module. Because PySyft cannot hook into layers which are implemented in C++, our special functionalities (such as encrypted computation) do not work with torch.nn.AvgPool2d and so we must have python ports available for all layer types which we seek to use.

Note that this module has been tested to ensure that it outputs the exact output values that the main module outputs in the same order that the main module does.

However, there is often some rounding error of unknown origin, usually less than 1e-6 in magnitude.

This module has not yet been tested with GPUs but should work out of the box.

forward(self, data)