Ntm#

Implementation of Neural Turing Machine

class ivy_memory.learnt.ntm.NTM(input_dim, output_dim, ctrl_output_size, ctrl_layers, memory_size, memory_vector_dim, read_head_num, write_head_num, v=None, usage=None, addressing_mode='content_and_location', shift_range=1, clip_value=20, init_value=1e-06, sequential_writing=False, retroactive_updates=False, retroactive_discount=0.96, with_erase=True)[source]#

Bases: Module

__init__(input_dim, output_dim, ctrl_output_size, ctrl_layers, memory_size, memory_vector_dim, read_head_num, write_head_num, v=None, usage=None, addressing_mode='content_and_location', shift_range=1, clip_value=20, init_value=1e-06, sequential_writing=False, retroactive_updates=False, retroactive_discount=0.96, with_erase=True)[source]#

Initialize Ivy layer, which is a stateful object consisting of trainable variables.

Parameters:
  • device – device on which to create the module’s variables ‘cuda:0’, ‘cuda:1’, ‘cpu’ etc. (Default value = None)

  • v – Ivy container of trainable variables. Created internally by default.

  • build_mode – How the Module is built, either on initialization (now), explicitly by the user by calling build(), or the first time the __call__ method is run. Default is on initialization.

  • compile_on_next_step – Whether to compile the network on the next forward pass. Default is False.

  • store_vars – Whether or not to store the variables created. Default is True.

  • stateful – The constant id stateful items to track as part of the forward pass. Used when graph compiling, default is None.

  • arg_stateful_idxs – The nested argument indices of stateful items to track as part of the forward pass. Used when graph compiling, default is None.

  • kwarg_stateful_idxs – The nested keyword argument indices of stateful items to track as part of the forward pass. Used when graph compiling, default is None.

  • fallback_to_non_compiled – Whether to fall back to non-compiled forward call in the case that an error is raised during the compiled forward pass. Default is True.

  • with_partial_v – Whether to allow partial specification of variables. Default is False.

  • devices – devices on which to distribute the module’s variables ‘cuda:0’, ‘cuda:1’, ‘cpu’ etc. (Default value = None)

class ivy_memory.learnt.ntm.NTMCell(controller, controller_proj, output_proj, output_dim, ctrl_input_size, ctrl_output_size, total_parameter_num, memory_size, memory_vector_dim, read_head_num, write_head_num, v=None, usage=None, addressing_mode='content_and_location', shift_range=1, clip_value=20, init_value=1e-06, sequential_writing=False, retroactive_updates=False, retroactive_discount=0.96, with_erase=True, seed=0)[source]#

Bases: Module

__init__(controller, controller_proj, output_proj, output_dim, ctrl_input_size, ctrl_output_size, total_parameter_num, memory_size, memory_vector_dim, read_head_num, write_head_num, v=None, usage=None, addressing_mode='content_and_location', shift_range=1, clip_value=20, init_value=1e-06, sequential_writing=False, retroactive_updates=False, retroactive_discount=0.96, with_erase=True, seed=0)[source]#

Initialize Ivy layer, which is a stateful object consisting of trainable variables.

Parameters:
  • device – device on which to create the module’s variables ‘cuda:0’, ‘cuda:1’, ‘cpu’ etc. (Default value = None)

  • v – Ivy container of trainable variables. Created internally by default.

  • build_mode – How the Module is built, either on initialization (now), explicitly by the user by calling build(), or the first time the __call__ method is run. Default is on initialization.

  • compile_on_next_step – Whether to compile the network on the next forward pass. Default is False.

  • store_vars – Whether or not to store the variables created. Default is True.

  • stateful – The constant id stateful items to track as part of the forward pass. Used when graph compiling, default is None.

  • arg_stateful_idxs – The nested argument indices of stateful items to track as part of the forward pass. Used when graph compiling, default is None.

  • kwarg_stateful_idxs – The nested keyword argument indices of stateful items to track as part of the forward pass. Used when graph compiling, default is None.

  • fallback_to_non_compiled – Whether to fall back to non-compiled forward call in the case that an error is raised during the compiled forward pass. Default is True.

  • with_partial_v – Whether to allow partial specification of variables. Default is False.

  • devices – devices on which to distribute the module’s variables ‘cuda:0’, ‘cuda:1’, ‘cpu’ etc. (Default value = None)

get_start_state(_=None, batch_size=None, dtype_str=None, v=None)[source]#
class ivy_memory.learnt.ntm.NTMControllerState(controller_state, read_vector_list, w_list, usage_indicator, M)[source]#

Bases: tuple

M#

Alias for field number 4

controller_state#

Alias for field number 0

read_vector_list#

Alias for field number 1

usage_indicator#

Alias for field number 3

w_list#

Alias for field number 2