indexers module

Full Documentation for hippynn.graphs.nodes.indexers module. Click here for a summary page.

Nodes for indexing information.

class AtomDeIndexer(name, parents, module='auto', **kwargs)[source]

Bases: ExpandParents, AutoNoKw, SingleNode

Node for converting Atom->SysAtom

Note

This node has parent expansion, following these procedures.

  1. If matching (Node), then apply expand0

  2. If matching (Node, Node), then apply expand0

  3. Asserts that the number of parents is 5

auto_module_class

alias of AtomDeIndexer

expand0(features, system_index, atom_index, n_mol, n_atom, **kwargs)[source]

Used for creation from parents with signature (Node, Node)

index_state: IdxType | None = 'SysAtom'
parent_expander: ParentExpander = <hippynn.graphs.nodes.base.definition_helpers.ParentExpander object>
class AtomReIndexer(name, parents, module='auto', **kwargs)[source]

Bases: ExpandParents, AutoNoKw, SingleNode

Node for re-using index information to convert SysAtom->Atom.

Note

This node has parent expansion, following these procedures.

  1. If matching (SingleNode), then apply expand0

  2. If matching (SingleNode, PaddingIndexer), then apply expand1

  3. Asserts that the number of parents is 2

auto_module_class

alias of AtomReIndexer

expand0(features, *, purpose, **kwargs)[source]

Used for creation from parents with signature (SingleNode)

expand1(features, pad_idx, **kwargs)[source]

Used for creation from parents with signature (SingleNode, PaddingIndexer)

index_state: IdxType | None = 'Atoms'
parent_expander: ParentExpander = <hippynn.graphs.nodes.base.definition_helpers.ParentExpander object>
class FilterBondsOneway(name, parents, module='auto', **kwargs)[source]

Bases: AutoNoKw, SingleNode

Node which filters the set of pairs to a one-way list.

auto_module_class

alias of FilterBondsOneway

index_state: IdxType | None = 'Unlabeled'
input_names = ('input_bonds', 'pair_first', 'pair_second')
class FuzzyHistogrammer(name, parents, length, vmin, vmax, module='auto', **kwargs)[source]

Bases: AutoKw, SingleNode

Node for transforming a scalar feature into a vectorized feature via the fuzzy/soft histogram method.

Parameters:

length – length of vectorized feature

auto_module_class

alias of FuzzyHistogram

auto_module_kwargs: Tuple[str] | Dict[str, str] | None = ('length', 'vmin', 'vmax')
input_names = 'values'
class OneHotEncoder(name, parents, species_set, module='auto', **kwargs)[source]

Bases: AutoKw, Encoder, MultiNode

Node for encoding species as one-hot vectors

auto_module_class

alias of OneHotSpecies

auto_module_kwargs: Tuple[str] | Dict[str, str] | None = ('species_set',)
output_index_states = (<IdxType.SysAtom>, <IdxType.SysAtom>)
output_names = ('encoding', 'nonblank')
class PaddingIndexer(name, parents, *args, **kwargs)[source]

Bases: AtomIndexer, AutoNoKw, ExpandParents, MultiNode, _DeprecatedNamesMixin

Node for building information to convert from SysAtom to Atom index state.

Note

This node has parent expansion, following these procedures.

  1. If matching (Encoder), then apply expand0

  2. Asserts that the number of parents is 2

auto_module_class

alias of PaddingIndexer

expand0(encoder, **kwargs)[source]

Used for creation from parents with signature (Encoder)

input_names = ('encoding', 'nonblank')
output_index_states = (<IdxType.Atoms>, None, None, None, None, None, None)
output_names = ('indexed_features', 'real_atoms', 'inv_real_atoms', 'system_index', 'atom_index', 'n_systems', 'n_atoms_max')
parent_expander: ParentExpander = <hippynn.graphs.nodes.base.definition_helpers.ParentExpander object>
class QuadUnpackNode(name, parents, module='auto', **kwargs)[source]

Bases: AutoNoKw, SingleNode

auto_module_class

alias of QuadUnpack

index_state: IdxType | None = 'Systems'
class SpeciesIndexer(name, parents, *args, module='auto', species_set=None, **kwargs)[source]

Bases: AutoNoKw, SingleNode, ExpandParents

Separate an atom-wise tensor into sub-tensors for each species.

Note

This node has parent expansion, following these procedures.

  1. If matching (Node, Node), then apply expansion0

  2. If matching (Node), then apply expansion1

  3. Asserts that the number of parents is 2

  4. Gets main_output of nodes: casts MultiNodes to their main output

  5. Transforms the parents to have index states (<IdxType.Atoms>, <IdxType.Atoms>)

auto_module_class

alias of SpeciesIndexer

expansion0(node_to_index, hint_node, **kwargs)[source]

For loss-graph quantities, we may need the information about /which/ species to use.

Used for creation from parents with signature (Node, Node)

expansion1(node_to_index, species_set, **kwargs)[source]

find onehot encoding.

Used for creation from parents with signature (Node)

with_species_equal(z_value)[source]
index_state: IdxType | None = 'Atoms'
input_names = ('input_values', 'onehot_encoding')
parent_expander: ParentExpander = <hippynn.graphs.nodes.base.definition_helpers.ParentExpander object>
class SysMaxOfAtomsNode(name, parents, module='auto', **kwargs)[source]

Bases: ExpandParents, AutoNoKw, SingleNode

auto_module_class

alias of SysMaxOfAtoms

expansion0(node, *, purpose, **kwargs)[source]

Used for creation from parents with signature (Node)

expansion1(node, pidxer, *, purpose, **kwargs)[source]

Used for creation from parents with signature (Node, AtomIndexer)

index_state: IdxType | None = 'Systems'
input_names = ('var', 'system_index', 'n_systems')
parent_expander: ParentExpander = <hippynn.graphs.nodes.base.definition_helpers.ParentExpander object>
acquire_encoding_padding(search_nodes, species_set, purpose=None)[source]

Automatically finds/builds a one-hot encoder and padding indexer starting from search_nodes.

If the encoder and padder exist as relatives of the search nodes.

Parameters:
  • search_nodes – Node or nodes to start from.

  • species_set – Species set to use if an encoder needs to be created.

  • purpose – String for error information if the process fails. (optional)

Returns:

encoder, padding indexer