Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/OpenMined/SyMPC
/ functions
Functions
591 in github.com/OpenMined/SyMPC
⨍
Functions
591
◇
Types & classes
44
↳
Endpoints
9
↓ 169 callers
Function
get_clients
()
tests/conftest.py:14
↓ 135 callers
Method
setup_mpc
Setup MPC. Must be called to send the session to all other parties involved in the computation. Args: session (S
src/sympc/session/session_manager.py:37
↓ 133 callers
Method
reconstruct
Reconstruct the secret. Request and get the shares from all the parties and reconstruct the secret. Depending on the value of "decode
src/sympc/tensor/mpc_tensor.py:359
↓ 29 callers
Method
backward
Perform the backward pass for the transpose operation. Args: ctx (Dict[str, Any]): Context used to retrieve the information for t
src/sympc/grads/grad_functions.py:109
↓ 23 callers
Method
distribute_shares
Forward the call to the tensor specific class. Args: *args (List[Any]): list of args to be forwarded **kwargs(Dict[st
src/sympc/protocol/fss/fss.py:231
↓ 22 callers
Function
parallel_execution
Wrap a function such that it can be run in parallel at multiple parties. Args: fn (Callable): The function to run. parties (Union
src/sympc/utils/utils.py:46
↓ 21 callers
Method
forward
(self, x)
tests/sympc/grad/grad_functions_test.py:36
↓ 19 callers
Function
wrapper_getattribute
Wrapper to make sure that we call __getattribute__ before anything else. Args: func (Callable[Any, Any]): The function to wrap Retur
src/sympc/tensor/mpc_tensor.py:46
↓ 17 callers
Function
get_new_generator
Get a generator that is initialized with seed. Args: seed (int): Seed. Returns: torch.Generator: Generator.
src/sympc/utils/mpc_utils.py:71
↓ 17 callers
Method
get_op
Returns method attribute based on ring_size and op_str. Args: ring_size (int): Ring size op_str (str): Operation stri
src/sympc/tensor/replicatedshare_tensor.py:243
↓ 16 callers
Method
generate_shares
Generate shares from secret. Given a secret, split it into a number of shares such that each party would get one. Args:
src/sympc/tensor/mpc_tensor.py:281
↓ 15 callers
Method
prrs_generate_random_share
Generates a random share using the generators held by a party. Args: shape (Union[tuple, torch.Size]): Shape for the share.
src/sympc/session/session.py:262
↓ 15 callers
Method
shares_sum
Returns sum of tensors based on ring_size. Args: shares (List[torch.Tensor]) : List of tensors. ring_size (int): Ring
src/sympc/tensor/replicatedshare_tensor.py:727
↓ 13 callers
Method
generate_primitives
Generate "op_str" primitives. Args: op_str (str): Operator. session (Session): Session. g_kwargs: Generat
src/sympc/store/crypto_primitive_provider.py:27
↓ 13 callers
Function
get_session
Gets the current session for a party as defined in the global space. Args: uuid (Union[UUID, str]): used to retrieve the session Ret
src/sympc/session/session_utils.py:12
↓ 12 callers
Function
get_type_from_ring
Type of a tensor given a ring size/field. Args: ring_size (int): Ring size. Returns: torch.dtype: Type of tensor. Raise
src/sympc/utils/mpc_utils.py:53
↓ 11 callers
Method
encode
Encode a value using the FixedPoint Encoder. Args: value (Union[torch.Tensor, float, int]): value to encode Returns:
src/sympc/encoder/fp_encoder.py:47
↓ 10 callers
Method
przs_generate_random_share
Generates a random zero share using the two generators held by a party. Args: shape (Union[tuple, torch.Size]): Shape for the sha
src/sympc/session/session.py:219
↓ 9 callers
Method
__apply_op
Apply an operation on "self" which is a MPCTensor "y". This function checks if "y" is private or public value. Args: y:
src/sympc/tensor/mpc_tensor.py:827
↓ 9 callers
Function
generate_random_element
Generate a new "random" tensor. Args: tensor_type (torch.dtype): Type of the tensor. generator (torch.Generator): Torch Generator
src/sympc/utils/mpc_utils.py:84
↓ 8 callers
Method
_get_shape
( op_str: str, x_shape: Tuple[int], y_shape: Tuple[int], **kwargs_: Dict[Any, Any] )
src/sympc/tensor/mpc_tensor.py:759
↓ 8 callers
Method
decode
Decode via FixedPrecisionEncoder. Returns: torch.Tensor: Decoded value
src/sympc/tensor/share_tensor.py:135
↓ 8 callers
Method
decode
Decode a value using the FixedPoint Encoder. Args: value (Union[int, torch.Tensor]): Value to decode. Returns:
src/sympc/encoder/fp_encoder.py:64
↓ 8 callers
Function
get_nr_bits
Get number of bits. Args: ring_size (int): Ring Size. Returns: int: Bit length.
src/sympc/utils/mpc_utils.py:114
↓ 8 callers
Method
get_primitives_from_store
Get primitives from store. Args: op_str (str): Operator to get. nr_instances (int): Number of instances.
src/sympc/store/crypto_store.py:46
↓ 8 callers
Function
ispointer
Check if a given obj is a pointer (is a remote object). Args: obj (Any): Object. Returns: bool: True (if pointer) or False (
src/sympc/utils/utils.py:19
↓ 8 callers
Method
sanity_checks
Check the type of "y" and covert it to share if necessary. Args: x (ShareTensor): Typically "self". y (Union[int, flo
src/sympc/tensor/share_tensor.py:147
↓ 7 callers
Function
exp
r"""Approximates the exponential function using a limit approximation. exp(x) = \lim_{n -> infty} (1 + x / n) ^ n Here we compute exp by choo
src/sympc/approximations/exponential.py:4
↓ 7 callers
Method
get_ring_size
Ring size of tensor. Returns: ring_size (str): Returns ring_size of tensor in string. It is typecasted to string as we c
src/sympc/tensor/replicatedshare_tensor.py:149
↓ 6 callers
Method
__check_or_convert
(value, session)
src/sympc/tensor/mpc_tensor.py:976
↓ 6 callers
Function
_reverse_broadcast
Reverse the broadcast operation. Credits goes to the CrypTen team. Args: x (MPCTensor): The value to be "reverse broadcasted"
src/sympc/grads/grad_functions.py:27
↓ 6 callers
Method
apply_function
Apply a given operation. Args: y (Union["ShareTensor", torch.Tensor, int, float]): tensor to apply the operator. op_s
src/sympc/tensor/share_tensor.py:181
↓ 6 callers
Method
bit_injection
Perform ABY3 bit injection for conversion of binary share to arithmetic share. Args: x (MPCTensor) : MPCTensor with shares of bit
src/sympc/protocol/aby3/aby3.py:273
↓ 6 callers
Function
reciprocal
r"""Calculate the reciprocal using the algorithm specified in the method args. Ref: https://github.com/facebookresearch/CrypTen Args:
src/sympc/approximations/reciprocal.py:9
↓ 6 callers
Method
xor
XOR operator. Args: y (Union["MPCTensor", torch.Tensor, int]): MPCTensor to find xor. Returns: MPCTensor: Re
src/sympc/tensor/mpc_tensor.py:1157
↓ 5 callers
Method
copy
Copy specific fields from the session. Returns: A copy of the current Session.
src/sympc/session/session.py:333
↓ 5 callers
Method
get_protocol
Get protocol. Returns: Protocol
src/sympc/session/session.py:180
↓ 5 callers
Method
mul
Apply the "mul" operation between "self" and "y". Args: y (Union["MPCTensor", torch.Tensor, float, int]): self * y Retur
src/sympc/tensor/mpc_tensor.py:452
↓ 5 callers
Function
sign
Calculate sign of given tensor. Args: data: tensor whose sign has to be determined Returns: MPCTensor: tensor with the deter
src/sympc/approximations/utils.py:4
↓ 4 callers
Method
__str__
Return the string representation of MPCTensor. Returns: str: String representation.
src/sympc/tensor/mpc_tensor.py:872
↓ 4 callers
Function
_get_triples
Get triples. The Trusted Third Party (TTP) or Crypto Provider should provide this triples Currently, the one that orchestrates the communicat
src/sympc/protocol/beaver/beaver.py:38
↓ 4 callers
Method
conv2d
Apply the "conv2d" operation between "self" and "y". Args: weight: the convolution kernel bias: optional bias
src/sympc/tensor/mpc_tensor.py:474
↓ 4 callers
Method
get_shares
Get the shares. Returns: List[MPCTensor]: List of shares.
src/sympc/tensor/mpc_tensor.py:397
↓ 4 callers
Method
sanity_checks
Check the type of "y" and convert it to share if necessary. Args: x (ReplicatedSharedTensor): Typically "self". y (Un
src/sympc/tensor/replicatedshare_tensor.py:269
↓ 4 callers
Method
start_logging
Sets the variable to True to start primitive logging.
src/sympc/store/crypto_primitive_provider.py:108
↓ 4 callers
Method
stop_logging
Sets the variable to False to stop primitive logging. Args: generate_file: when set to True generates a seperate primitive_log.js
src/sympc/store/crypto_primitive_provider.py:113
↓ 4 callers
Function
tanh
Calculates tanh of given tensor. Args: tensor (MPCTensor): whose sigmoid has to be calculated method (str): method to use while c
src/sympc/approximations/tanh.py:30
↓ 4 callers
Method
truncate
Perfoms the ABY3 truncation algorithm. Args: x (MPCTensor): input tensor session (Session) : session of the input ten
src/sympc/protocol/aby3/aby3.py:105
↓ 3 callers
Method
__apply_op
Apply a given operation ". This function checks if "y" is private or public value. Args: y (Union[ReplicatedSharedTenso
src/sympc/tensor/replicatedshare_tensor.py:390
↓ 3 callers
Method
__str__
Representation. Returns: str: Return the string representation of ShareTensor.
src/sympc/tensor/share_tensor.py:365
↓ 3 callers
Function
_generate_primitive
Generate FSS primitives. Args: op (str): type of operation (eq or comp) n_values (int): number of primitives to generate Ret
src/sympc/protocol/fss/fss.py:275
↓ 3 callers
Method
_transfer_primitives_to_parties
( op_str: str, primitives: List[Any], sessions: List[Session], p_kwargs: Dict[
src/sympc/store/crypto_primitive_provider.py:78
↓ 3 callers
Function
count_wraps
Count overflows and underflows if we reconstruct the original value. This function is taken from the CrypTen project. CrypTen repository: htt
src/sympc/utils/mpc_utils.py:23
↓ 3 callers
Function
factorial
(n)
src/sympc/approximations/sigmoid.py:63
↓ 3 callers
Function
forward
Perform the forward pass and construct the computational graph. Args: _self (MPCTensor): Perform grad_fn (GradFunc): The gradient
src/sympc/grads/grad_functions.py:766
↓ 3 callers
Method
generate_primitive_from_dict
Generates primitives from the log provided. Args: primitive_log (dict): the dict log created with primitive logging.
src/sympc/store/crypto_primitive_provider.py:132
↓ 3 callers
Method
generate_przs
Generate Pseudo-Random-Zero Shares. PRZS at the parties involved in the computation. Args: shape (Union[torch.Size, List
src/sympc/tensor/mpc_tensor.py:256
↓ 3 callers
Method
le
Lower or equal operator. Args: other (MPCTensor): MPCTensor to compare. Returns: MPCTensor: Result of the co
src/sympc/tensor/mpc_tensor.py:1069
↓ 3 callers
Function
log
Approximates the natural logarithm using 8th order modified Householder iterations. Recall that Householder method is an algorithm to solve a
src/sympc/approximations/log.py:6
↓ 3 callers
Method
mul_semi_honest
Falcon semihonest multiplication. Performs Falcon's mul implementation, add masks and performs resharing. Args: x (MPCTe
src/sympc/protocol/falcon/falcon.py:134
↓ 3 callers
Method
multiplication_protocol
Implementation of Falcon's multiplication with semi-honest security guarantee. Args: x (ReplicatedSharedTensor): Secret
src/sympc/protocol/falcon/falcon.py:380
↓ 3 callers
Method
populate_store
Populate items. Args: op_str (str): Operator to store. primitives (Iterables[Any]): Primitives to store.
src/sympc/store/crypto_store.py:28
↓ 3 callers
Method
private_compare
Falcon Private Compare functionality which computes(x>r). Args: x (List[MPCTensor]) : shares of bits of x in Zp. r (t
src/sympc/protocol/falcon/falcon.py:498
↓ 3 callers
Function
relu
Rectified linear unit function. Args: x (MPCTensor): The tensor on which we apply the function Returns: An MPCTensor which r
src/sympc/module/nn/functional.py:38
↓ 3 callers
Method
select_shares
Returns either x or y based on bit b. Args: x (MPCTensor): input tensor y (MPCTensor): input tensor b (MP
src/sympc/protocol/falcon/falcon.py:410
↓ 3 callers
Function
sigmoid
Approximates the sigmoid function using a given method. Args: tensor (Any): tensor to calculate sigmoid method (str): (default =
src/sympc/approximations/sigmoid.py:13
↓ 3 callers
Method
truediv
Apply the "div" operation between "self" and "y". Args: y (Union["MPCTensor", torch.Tensor, float, int]): Denominator. R
src/sympc/tensor/mpc_tensor.py:591
↓ 3 callers
Method
truncation_algorithm1
Performs the ABY3 truncation algorithm1. Args: ptr_list (List[torch.Tensor]): Tensors to truncate shape (torch.Size)
src/sympc/protocol/aby3/aby3.py:71
↓ 2 callers
Method
__init__
(self, torch_ref, kernel_size=5)
tests/sympc/module/module_test.py:34
↓ 2 callers
Function
_add_primitive
Add FSS primitives to the crypto store. Args: op (str): type of operation (eq or comp) store (Dict[Any,Any]): the crypto store
src/sympc/protocol/fss/fss.py:298
↓ 2 callers
Function
_ensure_fss_store
Create an empty store for FSS if it doesn't exist already. Args: store: the main crypto store
src/sympc/protocol/fss/fss.py:264
↓ 2 callers
Method
_generate_random_share
Generate random tensor share for the given shape and ring_size. Args: shape (Union[tuple, torch.Size]): Shape for the share.
src/sympc/session/session.py:188
↓ 2 callers
Function
_get_primitive
( op: str, store: Dict[Tuple[int, int], List[Any]], nr_instances: int, remove: bool = True,
src/sympc/protocol/fss/fss.py:322
↓ 2 callers
Function
_sanity_check_max_pool2d
Sanity check the parameters required for max_pool2d (backward and forward pass). Args: kernel_size (Union[int, Tuple[int, int]]): the ker
src/sympc/module/nn/functional.py:84
↓ 2 callers
Method
bit_decomposition_ttp
Perform ABY3 bit decomposition using orchestrator as ttp. Args: x (MPCTensor): Arithmetic shares of secret. session (
src/sympc/protocol/aby3/aby3.py:395
↓ 2 callers
Method
bit_extraction
Extracts the bit at the specified position. Args: pos (int): position to extract bit. Returns: ReplicatedSha
src/sympc/tensor/replicatedshare_tensor.py:586
↓ 2 callers
Method
decode
Decode via FixedPointEncoder. Returns: List[torch.Tensor]: Decoded values
src/sympc/tensor/replicatedshare_tensor.py:119
↓ 2 callers
Function
fss_op
Define the workflow for a binary operation using Function Secret Sharing. Currently supported operand are = & <=, respectively corresponding to
src/sympc/protocol/fss/fss.py:118
↓ 2 callers
Method
full_adder
Perform bit addition on MPCTensors using a full adder. Args: a (List[MPCTensor]): MPCTensor with shares of bit. b (Li
src/sympc/protocol/aby3/aby3.py:322
↓ 2 callers
Method
get_config
Config of tensor. Returns: config (Dict): returns config of the tensor as dict.
src/sympc/tensor/replicatedshare_tensor.py:159
↓ 2 callers
Function
helper_argmax
Compute argmax using pairwise comparisons. Makes the number of rounds fixed, here it is 2. This is inspired from CrypTen. Args: x (M
src/sympc/tensor/static.py:155
↓ 2 callers
Function
islocal
Check if a given obj is on the local machine (in Duet or VM). Args: obj (Any): Object. Returns: bool: True (if pointer) or F
src/sympc/utils/utils.py:33
↓ 2 callers
Function
log_softmax
Applies a softmax followed by a logarithm. While mathematically equivalent to log(softmax(x)), doing these two operations separately is slowe
src/sympc/approximations/softmax.py:39
↓ 2 callers
Function
modulus
Calculation of modulus for a given tensor. Args: data(MPCTensor): tensor whose modulus has to be calculated Returns: MPCTens
src/sympc/approximations/utils.py:16
↓ 2 callers
Method
mul_master
Master method for multiplication. Args: x (MPCTensor): Secret y (MPCTensor): Another secret session (Sess
src/sympc/protocol/falcon/falcon.py:86
↓ 2 callers
Method
pow
Compute integer power of a number by recursion using mul. - Divide power by 2 and multiply base to itself (if the power is even) - De
src/sympc/tensor/mpc_tensor.py:621
↓ 2 callers
Method
set_additional_attributes
Sets attributes of conv apart from weights. Args: attributes (Dict): Attributes with their values. Raises: V
src/sympc/module/nn/conv.py:86
↓ 2 callers
Function
softmax
Calculates tanh of given tensor's elements along the given dimension. Args: tensor (MPCTensor): whose softmax has to be calculated
src/sympc/approximations/softmax.py:12
↓ 2 callers
Function
sort
Takes a list of MPCTensors and sorts them in ascending/desending order using bubble sort. Args: input_list (List[MPCTensor]): Takes a lis
src/sympc/algorithms/algorithms.py:12
↓ 2 callers
Function
stack
Concatenates a sequence of tensors along a new dimension. Args: tensors (List): sequence of tensors to stacks dim (int): dimensio
src/sympc/tensor/static.py:26
↓ 1 callers
Method
__apply_private_op
Apply an operation on 2 RSTensors (secret shared values). Args: y (RelicatedSharedTensor): Tensor to apply the operation
src/sympc/tensor/replicatedshare_tensor.py:356
↓ 1 callers
Method
__apply_private_op
Apply an operation on 2 MPCTensor (secret shared values). Args: y (MPCTensor): Tensor to apply the operation op_str (
src/sympc/tensor/mpc_tensor.py:654
↓ 1 callers
Method
__apply_public_op
Apply an operation on "self" which is a RSTensor and a public value. Args: y (Union[torch.Tensor, float, int]): Tensor to apply t
src/sympc/tensor/replicatedshare_tensor.py:321
↓ 1 callers
Method
__apply_public_op
Apply an operation on "self" which is a MPCTensor and a public value. Args: y (Union[torch.Tensor, float, int]): Tensor to apply
src/sympc/tensor/mpc_tensor.py:719
↓ 1 callers
Method
__reconstruct_malicious
Reconstruct value from shares. Args: share_ptrs (List[ReplicatedSharedTensor]): List of RSTensor pointers. get_shares
src/sympc/tensor/replicatedshare_tensor.py:793
↓ 1 callers
Method
__reconstruct_semi_honest
Reconstruct value from shares. Args: share_ptrs (List[ReplicatedSharedTensor]): List of RSTensor pointers. get_shares
src/sympc/tensor/replicatedshare_tensor.py:764
↓ 1 callers
Method
__repr__
Representation. Returns: String representation.
src/sympc/tensor/share_tensor.py:379
↓ 1 callers
Function
_chebyshev_polynomials
r"""Evaluates odd degree Chebyshev polynomials at x. Chebyshev Polynomials of the first kind are defined as P_0(x) = 1, P_1(x) = x, P_n(x
src/sympc/approximations/tanh.py:106
↓ 1 callers
Method
_decode
Decodes shares list of RSTensor via FixedPointEncoder. Returns: List[torch.Tensor]: Decoded values
src/sympc/tensor/replicatedshare_tensor.py:127
↓ 1 callers
Method
_decode
(self)
src/sympc/tensor/share_tensor.py:143
next →
1–100 of 591, ranked by callers