pymoose.constant#

pymoose.constant(value, dtype=None, vtype=None, placement=None)[source]#

Embed a constant of a particular type.

Parameters
  • value – The Python value to embed as constant. Supported types include the Python native variants of those listed in pymoose.computation.types. Tensors are embeddable as numpy ndarrays.

  • dtype – If given, coerces value into a Moose tensor with this dtype. Otherwise, if value is an ndarray, the Moose dtype is inferred from the ndarray’s numpy dtype.

  • vtype – If given, coerces value into a Moose value with this vtype, i.e. ValueType. Otherwise, infers the vtype from value’s Python type.

  • placement – An optional Placement to pin this operation to.

Returns

A Moose Value of type vtype embedded into the computation graph.