.. _f-ortgradient: module ``training.ortgradient`` =============================== .. inheritance-diagram:: onnxcustom.training.ortgradient Short summary +++++++++++++ module ``onnxcustom.training.ortgradient`` Gradient with :epkg:`onnxruntime-training` forward backward. :githublink:`%|py|6` Classes +++++++ +------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ | class | truncated documentation | +==================================================================================================================+============================================================================================================================+ | :class:`OrtGradientForwardBackward ` | Implements forward backward mechanism assuming the function to train is defined by an ONNX graph. | +------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ | :class:`OrtGradientForwardBackwardFunction ` | Ancestor for a class implementing forward and backward and dynamically created by :class:`OrtGradientForwardBackward`. ... | +------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ Properties ++++++++++ +----------------------------------------------------------------------------------------------------------+--------------------------------------------+ | property | truncated documentation | +==========================================================================================================+============================================+ | :meth:`saved_tensors ` | Returns saved tensors during forward step. | +----------------------------------------------------------------------------------------------------------+--------------------------------------------+ Static Methods ++++++++++++++ +-------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------+ | staticmethod | truncated documentation | +=====================================================================================================================================+===========================================================+ | :py:meth:`_provider_name_to_device_type ` | | +-------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------+ | :py:meth:`_repr_helper_ ` | used to improve logging messages | +-------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------+ | :py:meth:`_select_initializer_names ` | Selects all initializers with float type. | +-------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------+ | :meth:`device_name ` | Returns the device name of a device. | +-------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------+ | :meth:`input_to_ort ` | Converts a list of tensos into an :epkg:`OrtValueVector`. | +-------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------+ | :meth:`save_onnx_graph ` | Saves onnx graph stored in this class. | +-------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------+ Methods +++++++ +------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+ | method | truncated documentation | +==================================================================================================================+================================================================================================+ | :py:meth:`__getstate__ ` | Removes any non pickable attribute. | +------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+ | :py:meth:`__init__ ` | | +------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+ | :py:meth:`__init__ ` | | +------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+ | :py:meth:`__repr__ ` | usual | +------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+ | :py:meth:`__setstate__ ` | Restores any non pickable attribute. | +------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+ | :py:meth:`_create_onnx_graphs ` | Creates forward and backward ONNX graph. The new class has the following attributes: | +------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+ | :py:meth:`_init_next ` | | +------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+ | :meth:`backward ` | Implements backward function. The function returns an :epkg:`OrtValueVector`. | +------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+ | :meth:`forward ` | Implements forward function. | +------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+ | :meth:`get_initializer ` | Returns an initializer as numpy arrays. | +------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+ | :meth:`new_instance ` | Creates an instance of class `self.cls_type_`. It implements methods *forward* and *backward*. | +------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+ | :meth:`save_for_backward ` | Saves inputs furing forward steps. The list inputs is copied (simple copy, no deep copy). | +------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+ Documentation +++++++++++++ .. automodule:: onnxcustom.training.ortgradient :members: :special-members: __init__ :show-inheritance: