concepts.dsl.tensor_state.NamedObjectTensorState#

class NamedObjectTensorState[source]#

Bases: TensorState, NamedObjectStateMixin

A state type with named objects.

Methods

clone()

clone_internals()

Clone the internals.

extra_state_str_after()

Extra state string.

extra_state_str_before()

Extra state string: add the objects.

get_nr_objects_by_type(typename)

Get the number of objects with the given type.

get_typed_index(name[, typename])

Get the typed index of the object with the given name.

get_typename(name)

Get the typename of the object with the given name.

summary_string()

Get a summary string of the state.

Attributes

batch_dims

The number of batchified dimensions.

features

internals

Additional internal information about the state.

nr_objects

The number of objects in the current state.

__getitem__(name)#
Parameters:

name (str)

__init__(features, object_names, object_types=None, batch_dims=0, internals=None)[source]#

Initialize the state.

Parameters:
__new__(**kwargs)#
clone()[source]#
Return type:

NamedObjectTensorState

clone_internals()#

Clone the internals.

extra_state_str_after()#

Extra state string.

Return type:

str

extra_state_str_before()[source]#

Extra state string: add the objects.

Return type:

str

get_nr_objects_by_type(typename)#

Get the number of objects with the given type.

Parameters:

typename (str)

Return type:

int

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).

Parameters:
  • name – the name of the object.

  • typename (str | None) – the typename of the object. If not specified, the default type of the object is used (i.e. the most specific type).

Returns:

the typed index of the object.

Return type:

int

get_typename(name)#

Get the typename of the object with the given name.

Parameters:

name (str)

Return type:

str

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:

str

property batch_dims: int#

The number of batchified dimensions. For the basic State, it should be 0.

property features: TensorValueDict#
property internals: Dict[str, Any]#

Additional internal information about the state.

property nr_objects: int#

The number of objects in the current state.