variable

tflearn.variables.variable (args, *kwargs)

Instantiate a new variable.

Arguments

  • name: str. A name for this variable.
  • shape: list of int. The variable shape (optional).
  • dtype: type. The variable data type.
  • initializer: str or Tensor. The variable initialization. (See tflearn.initializations for references).
  • regularizer: str or Tensor. The variable regularizer. (See tflearn.losses for references).
  • trainable: bool. If True, this variable weights will be trained.
  • collections: str. A collection to add the new variable to (optional).
  • caching_device: str. Optional device string or function describing where the Variable should be cached for reading. Defaults to the Variable's device.
  • validate_shape: bool. Validate or not shape when restoring.
  • device: str. Optional device ID to store the variable.
  • restore: bool. Restore or not this variable when loading a pre-trained model (Only compatible with tflearn pre-built training functions).

Returns

A Variable.


get_all_variables

tflearn.variables.get_all_variables ()

Get all Graph variables.

Returns

A list of Variables.


get_all_variables

tflearn.variables.get_all_trainable_variable ()

Get all Graph trainable variables.

Returns

A list of Variables.


get_layer_variables_by_name

tflearn.variables.get_layer_variables_by_name (name)

Retrieve a layer's variables, given its name.

Arguments

  • name: str. The layer name.

Returns

A list of Variables.


get_value

tflearn.variables.get_value (var, session=None)

Get a variable's value. If no session provided, use default one.

Arguments

  • var: Variable. The variable to get value from.
  • session: Session. The session to run the op. Default: the default session.

Returns

The variable's value.


set_value

tflearn.variables.set_value (var, value, session=None)

Set a variable's value. If no session provided, use default one.

Arguments

  • var: Variable. The variable to assign a value.
  • value: The value to assign. Must be compatible with variable dtype.
  • session: Session. The session to perform the assignation. Default: the default session.