Module

Base class for deriving trainable modules

class ivy.neural_net_stateful.module.Module(dev_str=None, v=None, build_mode='on_init', store_vars=True)[source]

Bases: abc.ABC

__init__(dev_str=None, v=None, build_mode='on_init', store_vars=True)[source]

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

Parameters
  • dev_str (str, optional) – device on which to create the layer’s variables ‘cuda:0’, ‘cuda:1’, ‘cpu’ etc.

  • v (ivy container, optional) – Ivy container of trainable variables. Created internally by default.

  • build_mode (str, optional) – 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.

  • store_vars (bool, optional) – Whether or not to store the variables created. Default is True.

build(*args, from_call=False, **kwargs)[source]

Build the internal layers and variables for this module.

property build_mode
property built
save_weights(weights_path)[source]

Save the weights on the Module. :param weights_path: The hdf5 file for saving the weights. :type weights_path: string

Module