concepts.dsl.constraint.cvt_opt_value#
- cvt_opt_value(value, dtype=None)[source]#
Convert a value to OptimisticValue or a (determined) TensorValue. Acceptable types are:
OptimisticValue
TensorValue, which will be converted to OptimisticValue if it corresponds to an optimistic value.
bool, which will be converted to TensorValue.
int, which will be converted to OptimisticValue if it is an optimistic identifier, otherwise TensorValue.
- Parameters:
value (OptimisticValue | TensorValue | StateObjectReference | bool | int) – the value to be converted.
dtype (TensorValueTypeBase | None) – the data type of the value. If not specified (and the input is a TensorValue), the data type of the value will be used.
- Returns:
The converted value.
- Return type: