module training._base_onnx_function#

Inheritance diagram of onnxcustom.training._base_onnx_function

Short summary#

module onnxcustom.training._base_onnx_function

Helper for onnxruntime-training.

source on GitHub

Classes#

class

truncated documentation

BaseLearningOnnx

Class handling ONNX function to manipulate OrtValue. Base class for BaseLearningRate and BaseLearningLoss. …

Static Methods#

staticmethod

truncated documentation

_bio_cache

_bio_do_bind_in

_bio_do_bind_out

_bio_ptr

_cache_in_clear

Methods#

method

truncated documentation

__getstate__

Overwrites getstate to get rid of InferenceSession.

__init__

__repr__

Usual

__repr_extended__

__setstate__

Overwrites getstate to get rid of InferenceSession.

_bind_input_ortvalue

Binds C_OrtValue to the structure used by InferenceSession to run inference.

_bind_output_ortvalue

Binds C_OrtValue to the structure used by InferenceSession to run inference.

build_onnx_function

This class computes a function represented as an ONNX graph. This method builds it. This function creates …

clear_binding_inputs

Clears binding and empty cache.

Documentation#

Helper for onnxruntime-training.

source on GitHub

class onnxcustom.training._base_onnx_function.BaseLearningOnnx#

Bases: BaseOnnxClass

Class handling ONNX function to manipulate OrtValue. Base class for BaseLearningRate and BaseLearningLoss.

source on GitHub

__getstate__()#

Overwrites getstate to get rid of InferenceSession.

source on GitHub

__init__()#
__repr__()#

Usual

source on GitHub

__repr_extended__()#
__setstate__(state)#

Overwrites getstate to get rid of InferenceSession.

source on GitHub

_bind_input_ortvalue(name, bind, c_ortvalue, device, cache=False)#

Binds C_OrtValue to the structure used by InferenceSession to run inference.

Parameters:
  • name – str

  • bind – python structure

  • c_ortvalue – C structure for OrtValue (C_OrtValue), it can be also a numpy array

  • device – device

  • cache – avoids binding again if the data pointer did not change, only works when c_ortvalue is of C_OrtValue, the cache is equivalent to a dictionary { id(bind), name: c_ort_value.data_ptr() }.

source on GitHub

_bind_output_ortvalue(name, bind, c_ortvalue, cache=False)#

Binds C_OrtValue to the structure used by InferenceSession to run inference.

Parameters:
  • name – str

  • bind – python structure

  • c_ortvalue – C structure for OrtValue (C_OrtValue)

  • cache – avoids binding again if the data pointer did not change, only works when c_ortvalue is of C_OrtValue, the cache is equivalent to a dictionary { id(bind), name: c_ort_value.data_ptr() }.

This method can be used for inplace computation.

source on GitHub

static _bio_cache(cache, name, bind, c_ortvalue, ptr2)#
static _bio_do_bind_in(name, bind, c_ortvalue)#
static _bio_do_bind_out(name, bind, c_ortvalue)#
static _bio_ptr(c)#
static _cache_in_clear(cache, name, bind)#
build_onnx_function(opset, device, *args)#

This class computes a function represented as an ONNX graph. This method builds it. This function creates InferenceSession which do that.

Parameters:
  • opset – opset to use

  • deviceC_OrtDevice

  • args – additional arguments

source on GitHub

clear_binding_inputs(name, bind, cache=False)#

Clears binding and empty cache.

source on GitHub