PondPublicTensor

class tf_encrypted.protocol.pond.PondPublicTensor(prot: tf_encrypted.protocol.pond.Pond, value_on_0: tf_encrypted.tensor.factory.AbstractTensor, value_on_1: tf_encrypted.tensor.factory.AbstractTensor, is_scaled: bool)[source]

This class represents a public tensor, known by at least the two servers but potentially known by more. Although there is only a single value we replicate it on both servers to avoid sending it from one to the other in the operations where it’s needed by both (eg multiplication).

shape
Return type:List[int]
Returns:The shape of this tensor.
unwrapped

Unwrap the tensor.

This will return the value for each of the parties that collectively own the tensor.

In most cases, this will be the same value on each device.

x_0, y_0 = tensor.unwrapped
# x_0 == 10 with the value pinned to player_0's device.
# y_0 == 10 with the value pinned to player_1's device.

In most cases you will want to work on this data on the specified device.

x_0, y_0 = tensor.unwrapped

with tf.device(prot.player_0.device_name):
    # act on x_0

with tf.device(prot.player_1.device_name):
    # act on y_0

In most cases you will not need to use this method. All funtions will hide this functionality for you (e.g. add, mul, etc).