Module

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

Bases: abc.ABC

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

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

Parameters
  • dev_str (str, optional) – device on which to create the module’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.

  • dev_strs (sequence of str, optional) – devices on which to distribute the module’s variables ‘cuda:0’, ‘cuda:1’, ‘cpu’ etc.

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

Build the internal layers and variables for this module.

property build_mode
property built
compile_graph(*args, v=None, with_grads=True, **kwargs)[source]
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


Supported Frameworks:

empty jax_logo empty tf_logo empty pytorch_logo empty mxnet_logo empty numpy_logo empty