Model.convert_position()

Model.convert_position()#

Model.convert_position(position, *, allow_unknown=False)[source]#

Converts the values in a position using their model-specific converters.

Variable keys use the converter configured on the respective Var; node keys use the converter configured on the respective Node. Unknown keys raise a KeyError unless allow_unknown=True, in which case their values are left unchanged.

This method is useful for constructing a typed Position at an API boundary, before repeatedly passing it through model computations.

Return type:

Position (dict[str, Any])