twodlearn.core.search module

class twodlearn.core.search.NoScopeParam(object, name, value)[source]

Bases: object

twodlearn.core.search.find_instances(model, classinfo)[source]

Finds any attribute in the model that is an instance of classinfo. Objects must be Hashable.

Parameters

classinfo – class or tuple of type objects.

Returns

set with the instances of classinfo found in the

model.

Return type

set

twodlearn.core.search.get_parameters(model, include_inputs=False)[source]

find the parameters in the model.

Parameters
  • model (TdlModel, TdlLayer) – model or nested sequence of models. Supports SingleNamespaces as well.

  • include_inputs (bool) – propagate the search through the inputs of the model.

Returns

list of parameters.

Return type

list

twodlearn.core.search.get_placeholder(model)[source]

find placeholder in a model.

Works similar to get_placeholders, but raises an error if more than one placeholder is found.

Parameters

model (type) – Description of parameter model.

Returns

Description of returned object.

Return type

type

twodlearn.core.search.get_placeholders(model)[source]

Find the placeholders of a TdlModel following attributes defined using the InferenceInput decorator.

Parameters

model (TdlModel) – TdlModel instance..

Returns

set of found placeholders.

Return type

set

twodlearn.core.search.get_trainable(model, include_inputs=True)[source]

get trainable variables of a model

Parameters
  • model (TdlModel, TdlLayer) – model or nested sequence of models. Supports SingleNamespaces as well.

  • include_inputs (bool) – propagate the search through the inputs of the model.

Returns

list of trainable variables.

Return type

list

twodlearn.core.search.get_variables(model, include_inputs=True)[source]

get tf variables of a model

Parameters
  • model (TdlModel, TdlLayer) – model or nested sequence of models. Supports SingleNamespaces as well.

  • include_inputs (bool) – propagate the search through the inputs of the model.

Returns

list of tf variables.

Return type

list

twodlearn.core.search.initialize_variables(model)[source]

Initialize variables for a given model that have not been initialized.

twodlearn.core.search.is_trainable(variable, scope=None)[source]

check if a variable is trainable

twodlearn.core.search.variables_initializer(var_list, name='init')[source]