MCPcopy Create free account

hub / github.com/OpenMined/SyMPC / functions

Functions591 in github.com/OpenMined/SyMPC

↓ 169 callersFunctionget_clients
()
tests/conftest.py:14
↓ 135 callersMethodsetup_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 callersMethodreconstruct
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 callersMethodbackward
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 callersMethoddistribute_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 callersFunctionparallel_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 callersMethodforward
(self, x)
tests/sympc/grad/grad_functions_test.py:36
↓ 19 callersFunctionwrapper_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 callersFunctionget_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 callersMethodget_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 callersMethodgenerate_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 callersMethodprrs_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 callersMethodshares_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 callersMethodgenerate_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 callersFunctionget_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 callersFunctionget_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 callersMethodencode
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 callersMethodprzs_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 callersMethod__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 callersFunctiongenerate_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 callersMethod_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 callersMethoddecode
Decode via FixedPrecisionEncoder. Returns: torch.Tensor: Decoded value
src/sympc/tensor/share_tensor.py:135
↓ 8 callersMethoddecode
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 callersFunctionget_nr_bits
Get number of bits. Args: ring_size (int): Ring Size. Returns: int: Bit length.
src/sympc/utils/mpc_utils.py:114
↓ 8 callersMethodget_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 callersFunctionispointer
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 callersMethodsanity_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 callersFunctionexp
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 callersMethodget_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 callersMethod__check_or_convert
(value, session)
src/sympc/tensor/mpc_tensor.py:976
↓ 6 callersFunction_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 callersMethodapply_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 callersMethodbit_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 callersFunctionreciprocal
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 callersMethodxor
XOR operator. Args: y (Union["MPCTensor", torch.Tensor, int]): MPCTensor to find xor. Returns: MPCTensor: Re
src/sympc/tensor/mpc_tensor.py:1157
↓ 5 callersMethodcopy
Copy specific fields from the session. Returns: A copy of the current Session.
src/sympc/session/session.py:333
↓ 5 callersMethodget_protocol
Get protocol. Returns: Protocol
src/sympc/session/session.py:180
↓ 5 callersMethodmul
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 callersFunctionsign
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 callersMethod__str__
Return the string representation of MPCTensor. Returns: str: String representation.
src/sympc/tensor/mpc_tensor.py:872
↓ 4 callersFunction_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 callersMethodconv2d
Apply the "conv2d" operation between "self" and "y". Args: weight: the convolution kernel bias: optional bias
src/sympc/tensor/mpc_tensor.py:474
↓ 4 callersMethodget_shares
Get the shares. Returns: List[MPCTensor]: List of shares.
src/sympc/tensor/mpc_tensor.py:397
↓ 4 callersMethodsanity_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 callersMethodstart_logging
Sets the variable to True to start primitive logging.
src/sympc/store/crypto_primitive_provider.py:108
↓ 4 callersMethodstop_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 callersFunctiontanh
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 callersMethodtruncate
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 callersMethod__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 callersMethod__str__
Representation. Returns: str: Return the string representation of ShareTensor.
src/sympc/tensor/share_tensor.py:365
↓ 3 callersFunction_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 callersMethod_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 callersFunctioncount_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 callersFunctionfactorial
(n)
src/sympc/approximations/sigmoid.py:63
↓ 3 callersFunctionforward
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 callersMethodgenerate_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 callersMethodgenerate_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 callersMethodle
Lower or equal operator. Args: other (MPCTensor): MPCTensor to compare. Returns: MPCTensor: Result of the co
src/sympc/tensor/mpc_tensor.py:1069
↓ 3 callersFunctionlog
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 callersMethodmul_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 callersMethodmultiplication_protocol
Implementation of Falcon's multiplication with semi-honest security guarantee. Args: x (ReplicatedSharedTensor): Secret
src/sympc/protocol/falcon/falcon.py:380
↓ 3 callersMethodpopulate_store
Populate items. Args: op_str (str): Operator to store. primitives (Iterables[Any]): Primitives to store.
src/sympc/store/crypto_store.py:28
↓ 3 callersMethodprivate_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 callersFunctionrelu
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 callersMethodselect_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 callersFunctionsigmoid
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 callersMethodtruediv
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 callersMethodtruncation_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 callersMethod__init__
(self, torch_ref, kernel_size=5)
tests/sympc/module/module_test.py:34
↓ 2 callersFunction_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 callersFunction_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 callersMethod_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 callersFunction_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 callersFunction_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 callersMethodbit_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 callersMethodbit_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 callersMethoddecode
Decode via FixedPointEncoder. Returns: List[torch.Tensor]: Decoded values
src/sympc/tensor/replicatedshare_tensor.py:119
↓ 2 callersFunctionfss_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 callersMethodfull_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 callersMethodget_config
Config of tensor. Returns: config (Dict): returns config of the tensor as dict.
src/sympc/tensor/replicatedshare_tensor.py:159
↓ 2 callersFunctionhelper_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 callersFunctionislocal
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 callersFunctionlog_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 callersFunctionmodulus
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 callersMethodmul_master
Master method for multiplication. Args: x (MPCTensor): Secret y (MPCTensor): Another secret session (Sess
src/sympc/protocol/falcon/falcon.py:86
↓ 2 callersMethodpow
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 callersMethodset_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 callersFunctionsoftmax
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 callersFunctionsort
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 callersFunctionstack
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 callersMethod__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 callersMethod__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 callersMethod__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 callersMethod__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 callersMethod__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 callersMethod__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 callersMethod__repr__
Representation. Returns: String representation.
src/sympc/tensor/share_tensor.py:379
↓ 1 callersFunction_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 callersMethod_decode
Decodes shares list of RSTensor via FixedPointEncoder. Returns: List[torch.Tensor]: Decoded values
src/sympc/tensor/replicatedshare_tensor.py:127
↓ 1 callersMethod_decode
(self)
src/sympc/tensor/share_tensor.py:143
next →1–100 of 591, ranked by callers