module training._base_onnx_function
#
Short summary#
module onnxcustom.training._base_onnx_function
Helper for onnxruntime-training.
Classes#
class |
truncated documentation |
---|---|
Class handling ONNX function to manipulate OrtValue. Base class for |
Static Methods#
staticmethod |
truncated documentation |
---|---|
Methods#
method |
truncated documentation |
---|---|
Overwrites getstate to get rid of InferenceSession. |
|
Usual |
|
Overwrites getstate to get rid of InferenceSession. |
|
Binds C_OrtValue to the structure used by InferenceSession to run inference. |
|
Binds C_OrtValue to the structure used by InferenceSession to run inference. |
|
This class computes a function represented as an ONNX graph. This method builds it. This function creates … |
|
Clears binding and empty cache. |
Documentation#
Helper for onnxruntime-training.
- class onnxcustom.training._base_onnx_function.BaseLearningOnnx#
Bases:
BaseOnnxClass
Class handling ONNX function to manipulate OrtValue. Base class for
BaseLearningRate
andBaseLearningLoss
.- __getstate__()#
Overwrites getstate to get rid of InferenceSession.
- __init__()#
- __repr__()#
Usual
- __repr_extended__()#
- __setstate__(state)#
Overwrites getstate to get rid of InferenceSession.
- _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() }.
- _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.
- 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
device – C_OrtDevice
args – additional arguments
- clear_binding_inputs(name, bind, cache=False)#
Clears binding and empty cache.