pymoose package#

Subpackages#

eDSL Values & Types#

Argument(placement[, dtype, vtype])

A type annotation Arguments to Moose computations.

AesKeyType()

Moose value representing an AES key.

AesTensorType(dtype)

Moose Value representing a tensor of AES-encrypted values.

FloatType()

Moose value representing a Python float.

IntType()

Moose value representing a Python integer.

TensorType(dtype)

Moose Value representing a Tensor.

StringType()

Moose value representing a Python string.

eDSL DTypes#

bool_

Generic implementation of a Moose DType

fixed(integ, frac)

Factory function for creating a fixedpoint DType.

float32

Generic implementation of a Moose DType

float64

Generic implementation of a Moose DType

int32

Generic implementation of a Moose DType

int64

Generic implementation of a Moose DType

uint64

Generic implementation of a Moose DType

ring64

Generic implementation of a Moose DType

eDSL Placement Factories#

host_placement(name)

mirrored_placement(name, players)

replicated_placement(name, players)

eDSL Functions#

abs(x[, placement])

Compute the absolute value.

add(lhs, rhs[, placement])

Add two values.

add_n(arrays[, placement])

Elementwise addition of a collection of tensors.

argmax(x, axis, upmost_index[, placement])

Compute the index of the maximal element of a tensor along a given dimension.

atleast_2d(x[, to_column_vector, placement])

cast(x, dtype[, placement])

Cast a tensor to a new dtype.

concatenate(arrays[, axis, placement])

Concatenation of a collection of tensors along a given axis/dimension.

constant(value[, dtype, vtype, placement])

Embed a constant of a particular type.

decrypt(key, ciphertext[, placement])

div(lhs, rhs[, placement])

Divide two tensors.

dot(lhs, rhs[, placement])

Dot product of two tensors.

exp(x[, placement])

Elementiwise exponential function: \(e^x\).

expand_dims(x, axis[, placement])

Expand the rank of x with new singleton dimensions.

greater(lhs, rhs[, placement])

Evaluate the boolean greater-than operation, i.e. lhs > rhs.

identity(x[, placement])

The identity operation, f(x) = x.

index_axis(x, axis, index[, placement])

Index a tensor along a given dimension.

inverse(x[, placement])

Invert a floating-point matrix.

less(lhs, rhs[, placement])

Evaluate the boolean less-than operation, i.e. lhs < rhs.

load(key[, query, dtype, vtype, placement])

Load a value from placement storage.

log(x[, placement])

Compute the elementwise natural logarithm of a tensor.

log2(x[, placement])

Compute the elementwise base-2 logarithm of a tensor.

logical_and(lhs, rhs[, placement])

Evaluate the boolean AND operation, i.e. lhs & rhs.

logical_or(lhs, rhs[, placement])

Evaluate the boolean OR operation, i.e. lhs | rhs.

maximum(arrays[, placement])

Elementwise maximum of a collection of input tensors.

mean(x[, axis, placement])

Mean-reduce an input tensor.

mul(lhs, rhs[, placement])

Multiply two values.

mux(selector, x, y[, placement])

Multiplex two tensors according to some condition.

ones(shape, dtype[, placement])

Embed a ones array into the Moose computation graph.

output(tag, value[, placement])

Tag an output of a computation.

relu(x[, placement])

Apply the rectified-linear unit (ReLU) function, f(x) = max(0, x).

reshape(x, shape[, placement])

Reshape a tensor.

save(key, value[, placement])

Save a key-value pair to placement storage.

select(x, axis, index[, placement])

Select elements along some axis of a tensor according to some index tensor.

shape(x[, placement])

Compute the shape of an input tensor.

sliced(x, begin, end[, placement])

Compute a slice of a value.

softmax(x, axis, upmost_index[, placement])

Softmax function.

square(x[, placement])

Square an input value.

squeeze(x[, axis, placement])

Reduce out any singleton dimensions of x.

strided_slice(x, slices[, placement])

Compute a strided slice of a value.

sigmoid(x[, placement])

Apply the sigmoid function, \(\frac{1}{1 + e^{-x}}\).

sub(lhs, rhs[, placement])

Subtract two values.

sum(x[, axis, placement])

Sum-reduce an input tensor.

sqrt(x[, placement])

Compute the square-root of a value \(\sqrt{x}\).

transpose(x[, placement])

Compute the transpose of a tensor.

zeros(shape, dtype[, placement])

Embed a zeros array into the Moose computation graph.

PyMoose Context#

get_current_placement()

get_current_runtime()

Get a global runtime context.

set_current_runtime(runtime)

Set a global runtime context.

Moose Bindings#

computation([func, role_map])

Annotates a Python function as a Moose computation.

elk_compiler

GrpcMooseRuntime(identities)

Moose runtime backed by gRPC choreography.

LocalMooseRuntime(identities[, storage_mapping])

Locally-simulated Moose runtime.

MooseComputation