\begin{table}[h]
\setlength{\tabcolsep}{4pt}
\rowcolors{2}{gray!25}{white}
\resizebox{\linewidth}{!}{
\begin{tabular}{lcl}
\toprule
\bf Function & \bf Function name(s) & \bf Description\\
\midrule
Absolute & \texttt{abs} & Multiply value by its sign.\\
Addition & \texttt{add}, \texttt{+} & Each party adds their shares.\\
Argument of maximum & \texttt{argmax} & Perform pairwise comparisons or tree reduction.\\
Argument of minimum & \texttt{argmin} & Perform pairwise comparisons or tree reduction.\\
Average pooling & \texttt{avg\_pool2d} & Each party computes the average pooling of its share.\\
Batch normalization & \texttt{batchnorm} & Batch normalize values using summation, division, and variance functions.\\
Binary AND & \texttt{and}, \texttt{\&} & Compute using binary Beaver protocol.\\
Binary cross-entropy & \texttt{binary\_cross\_entropy} & Compute using logarithm, multiplication, and addition functions.\\
Binary XOR & \texttt{xor}, \texttt{\^} & Each party XORs it shares.\\
Clone & \texttt{clone} & Each party clones their share.\\
Comparison & \texttt{>=}, \texttt{<=}, \texttt{=}, \texttt{ge}, \texttt{le}, \texttt{eq} & To compare to $0$, convert to binary secret share and inspect most significant bit.\\
Concatenation & \texttt{cat} & Each party concatenates their shares.\\
\multirow{-2}{*}{Convolution} & \multirow{-2}{*}{\texttt{conv1d}, \texttt{conv2d}} & \shortstack[l]{If filter is public, each party convolves its share.\\If filter is private, compute using Beaver protocol.}\\
Cosine & \texttt{cos} & Approximate using repeated-squaring method.\\
Cross-entropy & \texttt{cross\_entropy} & Compute using softmax, logarithm, multiplication, and division functions.\\
Cumulative sum & \texttt{cumsum} & Each party computes cumulative sum of values in its share.\\
Division & \texttt{div}, \texttt{/} & If divisor is public, divide shares by value and correct for wrap-around errors.\\
Dot product & \texttt{dot} & Multiply all elements and sum results.\\
\multirow{-2}{*}{Dropout} & \multirow{-2}{*}{\texttt{dropout}} & \shortstack[l]{Each party multiplies their share with dropout mask.\\Dropout mask is not encrypted.}\\
Error function & \texttt{erf} & Approximate using Maclaurin series.\\
Exponent & \texttt{exp} & Approximate using limit approximation.\\
Flatten & \texttt{flatten} & Each party flattens their share.\\
Flip & \texttt{flip} & Each party flips their share.\\
Hard tangent & \texttt{hardtanh} & Compute using comparison, multiplication, and addition functions.\\
Logarithm & \texttt{log} & Approximate using higher-order modified Householder method.\\
Log-softmax & \texttt{log\_softmax} & Compute using exponentiation, maximum, summation, and addition functions.\\
\multirow{-2}{*}{Matrix multiplication} & \multirow{-2}{*}{\texttt{matmul}} & \shortstack[l]{If one matrix is public, each party matrix-multiplies its share.\\If both matrices are private, compute using Beaver protocol.}\\
Maximum & \texttt{max} & Compute argmax as one-hot vector; compute dot product with input.\\
Max pooling & \texttt{max\_pool2d} & Compute maximum value.\\
Mean & \texttt{mean} & Each party computes mean of its share.\\
Minimum & \texttt{min} & Compute argmin as one-hot vector; compute dot product with input.\\
\multirow{-2}{*}{Multiplication} & \multirow{-2}{*}{\texttt{mul}, \texttt{*}} & \shortstack[l]{If multiplier is public, each party multiplies its share with the\\multiplier. If multiplier is private, use Beaver protocol.}\\
Multiplexing & \texttt{where} & Multiply first value by binary mask; add second value multiplied by inverse mask.\\
Negation & \texttt{neg} & Each party negates their share.\\
Norm & \texttt{norm} & Compute using the square, sum, and square root functions.\\
Outer product & \texttt{ger} & Perform multiplication of each pair of elements.\\
Padding & \texttt{pad} &Each party pads their share.\\
Permute & \texttt{permute} & Each party permutes their share. Indexes are not encrypted.\\
Product & \texttt{prod} & Multiply all elements in the input.\\
\multirow{-2}{*}{Power} & \multirow{-2}{*}{\texttt{pow}, \texttt{pos\_pow}} & \shortstack[l]{For positive powers, multiply in log-domain and exponentiate.\\For negative powers, compute reciprocal and evaluate positive power.}\\
Reciprocal & \texttt{reciprocal} & Approximate using Newton-Rhapson iterations.\\
ReLU & \texttt{relu}, \texttt{relu6} & Compare values with $0$, and multiply values by the resulting mask.\\
Reshaping & \texttt{reshape}, \texttt{view} & Each party reshapes their share.\\
Rolling & \texttt{roll} & Each party rolls their share.\\
\multirow{-2}{*}{Scattering} & \multirow{-2}{*}{\texttt{scatter}} & \shortstack[l]{Each party scatters one share into the other share.\\Indexes are not encrypted.}\\
\multirow{-3}{*}{Selection} & \shortstack{\texttt{gather},\\ \texttt{index\_select},\\ \texttt{narrow}, \texttt{take}} & \multirow{-3}{*}{Each party selects part of their share. Indexes are not encrypted.}\\
Sigmoid & \texttt{sigmoid} & Compute using the exponential and reciprocal functions.\\
Sign & \texttt{sign} & Compare value with $0$, multiply by $2$, and subtract $1$.\\
Sine & \texttt{sin} & Approximate using repeated-squaring method.\\
Softmax & \texttt{softmax} & Compute using exponentiation, maximum, summation, and reciprocal functions.\\
Square & \texttt{square} & Compute using Beaver protocol.\\
Square root & \texttt{sqrt} & Approximate using Newton-Rhapson iterations.\\
Squeezing & \texttt{squeeze} & Each party removes dimensions with size $1$ from their share.\\
Stacking & \texttt{stack} & Each party stacks their shares.\\
Subtraction & \texttt{sub}, \texttt{-} & Each party subtracts their shares.\\
Summation & \texttt{sum} & Each party sums all values in its share.\\
Tangent & \texttt{tanh} & Perform linear transformation of sigmoid value of output.\\
Trace & \texttt{trace} & Each party sums all diagonal elements of their share.\\
Transpose & \texttt{t}, \texttt{transpose} & Each party transposes their share.\\
Unsqueezing & \texttt{unsqueeze} & Each party adds dimensions with size $1$ to their share.\\
Variance & \texttt{var} & Compute using square, addition, and subtraction functions.\\
\bottomrule
\end{tabular} 
}
\caption{Overview of all functions on tensors implemented in \crypten{}.}
\label{tab:functions_detail}
\end{table}
Absolute abs Multiply value by its sign.
Addition add, + Each party adds their shares.
Argument of maximum argmax Perform pairwise comparisons or tree reduction.
Argument of minimum argmin Perform pairwise comparisons or tree reduction.
Average pooling avg_pool2d Each party computes the average pooling of its share.
Batch normalization batchnorm Batch normalize values using summation, division, and variance functions.
Binary AND and, & Compute using binary Beaver protocol.
Binary cross-entropy binary_cross_entropy Compute using logarithm, multiplication, and addition functions.
Binary XOR xor, ˆ Each party XORs it shares.
Clone clone Each party clones their share.
Comparison >=, <=, =, ge, le, eq To compare to 0, convert to binary secret share and inspect most significant bit.
Concatenation cat Each party concatenates their shares.
Convolution conv1d, conv2d If filter is public, each party convolves its share.
If filter is private, compute using Beaver protocol.
Cosine cos Approximate using repeated-squaring method.
Cross-entropy cross_entropy Compute using softmax, logarithm, multiplication, and division functions.
Cumulative sum cumsum Each party computes cumulative sum of values in its share.
Division div, / If divisor is public, divide shares by value and correct for wrap-around errors.
Dot product dot Multiply all elements and sum results.
Dropout dropout Each party multiplies their share with dropout mask.
Dropout mask is not encrypted.
Error function erf Approximate using Maclaurin series.
Exponent exp Approximate using limit approximation.
Flatten flatten Each party flattens their share.
Flip flip Each party flips their share.
Hard tangent hardtanh Compute using comparison, multiplication, and addition functions.
Logarithm log Approximate using higher-order modified Householder method.
Log-softmax log_softmax Compute using exponentiation, maximum, summation, and addition functions.
Matrix multiplication matmul If one matrix is public, each party matrix-multiplies its share.
If both matrices are private, compute using Beaver protocol.
Maximum max Compute argmax as one-hot vector; compute dot product with input.
Max pooling max_pool2d Compute maximum value.
Mean mean Each party computes mean of its share.
Minimum min Compute argmin as one-hot vector; compute dot product with input.
Multiplication mul, * If multiplier is public, each party multiplies its share with the
multiplier. If multiplier is private, use Beaver protocol.
Multiplexing where Multiply first value by binary mask; add second value multiplied by inverse mask.
Negation neg Each party negates their share.
Norm norm Compute using the square, sum, and square root functions.
Outer product ger Perform multiplication of each pair of elements.
Padding pad Each party pads their share.
Permute permute Each party permutes their share. Indexes are not encrypted.
Product prod Multiply all elements in the input.
Power pow, pos_pow For positive powers, multiply in log-domain and exponentiate.
For negative powers, compute reciprocal and evaluate positive power.
Reciprocal reciprocal Approximate using Newton-Rhapson iterations.
ReLU relu, relu6 Compare values with 0, and multiply values by the resulting mask.
Reshaping reshape, view Each party reshapes their share.
Rolling roll Each party rolls their share.
Scattering scatter Each party scatters one share into the other share.
Indexes are not encrypted.
Selection gather,
index_select,
narrow, take Each party selects part of their share. Indexes are not encrypted.
Sigmoid sigmoid Compute using the exponential and reciprocal functions.
Sign sign Compare value with 0, multiply by 2, and subtract 1.
Sine sin Approximate using repeated-squaring method.
Softmax softmax Compute using exponentiation, maximum, summation, and reciprocal functions.
Square square Compute using Beaver protocol.
Square root sqrt Approximate using Newton-Rhapson iterations.
Squeezing squeeze Each party removes dimensions with size 1 from their share.
Stacking stack Each party stacks their shares.
Subtraction sub, - Each party subtracts their shares.
Summation sum Each party sums all values in its share.
Tangent tanh Perform linear transformation of sigmoid value of output.
Trace trace Each party sums all diagonal elements of their share.
Transpose t, transpose Each party transposes their share.
Unsqueezing unsqueeze Each party adds dimensions with size 1 to their share.
Variance var Compute using square, addition, and subtraction functions.