concepts.dsl.tensor_state.NamedObjectTensorState#
- class NamedObjectTensorState[source]#
Bases:
TensorState
,NamedObjectStateMixin
A state type with named objects.
Methods
clone
()Clone the internals.
Extra state string.
Extra state string: add the objects.
get_default_typename
(name)Get the typename of the object with the given name.
get_name
(typename, index)Get the name of the object with the given type and index.
get_nr_objects_by_type
(typename)Get the number of objects with the given type.
get_objects_by_type
(typename)Get the names of the objects with the given type.
get_state_object_list
(dtype[, indices, names])Get a list of object references with the given type and indices.
get_state_object_reference
(dtype[, index, name])Get the object reference with the given type and index.
get_typed_index
(name[, typename])Get the typed index of the object with the given name.
Get a summary string of the state.
Attributes
The number of batchified dimensions.
Additional internal information about the state.
The number of objects in the current state.
- __init__(features, object_names, object_types=None, batch_dims=0, internals=None)[source]#
Initialize the state.
- Parameters:
features (Mapping[str, Any] | MultidimensionalArrayInterface | None) – the features of the state.
object_types (Iterable[ObjectType] | None) – the types of the objects.
object_names (Iterable[str] | Mapping[str, ObjectType]) – the names of the objects. If the object_names is a mapping, the object_types should be None.
batch_dims (int) – the number of batchified dimensions.
internals (Mapping[str, Any] | None) – the internals of the state.
- __new__(**kwargs)#
- clone_internals()#
Clone the internals.
- get_default_typename(name)#
Get the typename of the object with the given name.
- get_name(typename, index)#
Get the name of the object with the given type and index.
- get_nr_objects_by_type(typename)#
Get the number of objects with the given type.
- get_objects_by_type(typename)#
Get the names of the objects with the given type.
- get_state_object_list(dtype, indices=None, names=None)#
Get a list of object references with the given type and indices.
- Parameters:
- Return type:
- get_state_object_reference(dtype, index=None, name=None)#
Get the object reference with the given type and index.
- Parameters:
dtype (ObjectType | str)
index (int | None)
name (str | None)
- Return type:
- get_typed_index(name, typename=None)#
Get the typed index of the object with the given name. There is an additional typename argument to specify the type of the object. Because the same object can have multiple types (due to inheritence), the object can have multiple typed indices, one for each type. When the typename is not specified, the default type of the object is used (i.e., the most specific type).
- summary_string()#
Get a summary string of the state. The main difference between this and __str__ is that this function only formats the shape of intermediate tensors.
- Return type:
- property features: TensorValueDict#