pymoose.constant
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
valueinto a Moose tensor with this dtype. Otherwise, ifvalueis an ndarray, the Moose dtype is inferred from the ndarray’s numpy dtype.vtype – If given, coerces
valueinto a Moose value with this vtype, i.e. ValueType. Otherwise, infers the vtype fromvalue’s Python type.placement – An optional
Placementto pin this operation to.
- Returns
A Moose Value of type
vtypeembedded into the computation graph.