Functions

Summary

function

class parent

truncated documentation

_default_inputs

Guesses default inputs (float ones) if not specified.

_demangle

Demangle a C++ identifier using c++filt

_existing_names

Makes the list of existing names. Returns a set of unique names including intermediate results.

_finalize_new_onnx

_loss_elastic

Implements mixture of losses l1 and l2.

_loss_l1

Implements loss l1.

_loss_l2

Implements loss l2.

_loss_log

This only works for a binary classification. The log loss is ‘log(yt, yp) = (1-yt)log(1-yp) - ytlog(yp), this …

_munge_time

Take a time from nvprof and convert it into a chrome://tracing time.

_onnx_axpy

Returns the ONNX graph for function Y = f(X1, X2, \alpha) = \alpha X1 + X2.

_onnx_axpyw

Returns the ONNX graph for function Y, Z = f(X1, X2, G, \alpha, \beta) = (Y, Z) where Z = \beta G + \alpha X1

_onnx_axpyw2

Returns the ONNX graph for function Y, Z = f(X1, X2, G, \alpha, \beta) = (Y, Z) where Z = \beta G + \alpha X1

_onnx_copy

Returns the ONNX graph for function Y = X.

_onnx_derivative_fw

Implements a gradient based on class OrtModuleGraphBuilder.

_onnx_derivative_loss

Implements a gradient based on class PyGradientGraphBuilder.

_onnx_grad_loss_absolute_error

Returns the ONNX graph for function Y = f(X1, X2) = \lVert X1 - X2 \rVert or Y = f(X1, X2) = \lVert (X1 - X2)w \rVert

_onnx_grad_loss_elastic_error

Returns the ONNX graph for function Y = f(X1, X2) = \beta \lVert X1 - X2 \rVert + \alpha \lVert X1 - X2 \rVert^2

_onnx_grad_loss_square_error

Returns the ONNX graph for function Y = f(X1, X2) = \lVert (X1 - X2) \rVert ^2 or Y = f(X1, X2) = \lVert (\sqrt{w}(X1 - X2) \rVert ^2 w

_onnx_grad_penalty_elastic_error

Returns the ONNX graph for function Y = f(W) = \beta \lVert W \rVert + \alpha \lVert W \rVert^2 l1_weight

_onnx_grad_sigmoid_neg_log_loss_error

The function the raw scores from a classifier, uses the sigmoid function to compute probabilities, then the log function …

_onnx_grad_square_error

Returns the ONNX graph for the gradient of function Y = f(X1, X2) = \lVert X1 - X2 \rVert ^2 or Y = f(X1, X2) = \lVert X1 - X2 \rVert ^2 w

_onnx_linear_regression

Returns the ONNX graph for function Y = f(X, A, B) = A X + B.

_onnx_n_penalty_elastic_error

Returns the ONNX graph for function Y = f(W) = \beta \lVert W \rVert + \alpha \lVert W \rVert^2 l1_weight

_onnx_rewrite_operator_node

Replaces a node by a subgraph.

_onnx_square_error

Returns the ONNX graph for function Y = f(X1, X2) = \lVert X1 - X2 \rVert ^2 or Y = f(X1, X2) = \lVert X1 - X2 \rVert ^2 w

_onnx_update_penalty_elastic_error

Returns the ONNX graph for function Y = f(W) = W - 2 \beta W - \alpha sign(W) l1 is \beta and …

_onnx_zero

Returns the ONNX graph for function Y = X * 0.

_rewrite_op_no_grad

Rewrites operators with no gradient.

_sizeof_fmt

Format size with metric units (like nvvp)

_unique_name

Returns a name different from any name in existing_names.

_unique_name

Returns a name different from any name in existing_names.

add_initializer

Adds an initializer to graph.

add_loss_output

Modifies an ONNX graph to add operators to score and allow training.

check

Runs a couple of functions to check the module is working.

convert_trace_to_json

Converts traces produced by nvprof and saved with format sqlite3 (extension .sql). The output format …

device_to_providers

Returns the corresponding providers for a specific device.

dtype_to_var_type

Converts a numpy dtype into a var type.

fix_link_operator_md

The redering of file Operator.md breaks links. This …

function_onnx_graph

Returns the ONNX graph corresponding to a function.

get_class_names

Returns the class names for the ImageNet competition as a dictionary.

get_max_opset

Returns the highest available onnx opset version.

get_onnx_opset

Returns the opset associated to an opset.

get_ort_device

Converts device into C_OrtDevice.

get_ort_device_type

Converts device into device type.

get_supported_functions

Returns the list of supported function by function_onnx_graph().

get_train_initializer

Returns the list of initializers to train.

json_to_dataframe

Converts a json dump obtained with function convert_trace_to_json() to a dataframe.

json_to_dataframe_streaming

Converts a big json dump (from convert_trace_to_json()) to a dataframe. The function processes the data by streaming …

main

Implements python -m onnxcustom <command> <args>.

measure_time

Measures a statement and returns the results as a dictionary.

numpy_to_ort_value

Converts a numpy array to C_OrtValue.

nvprof2json

Converts traces produced by nvprof and saved with format sqlite3 (extension .sql).

onnx_derivative

Builds the gradient for an onnx graph.

onnx_rename_weights

Renames ONNX initializers to make sure their name follows the alphabetical order. The model is modified inplace. …

onnx_rewrite_operator

Replaces one operator by an onnx graph.

ort_device_to_string

Returns a string representing the device. Opposite of function get_ort_device().

penalty_loss_onnx

Returns onnx nodes to compute |w| \alpha + w^2 \beta where \alpha=l1 and \beta=l2.

plot_onnxs

Plots one or several ONNX graph into a matplotlib graph.

proto_type_to_dtype

Converts a ONNX TensorProto type into numpy type.

provider_to_device

Converts provider into a device.

replace_initializers_into_onnx

Replaces initializers by other initializers, usually trained ones.

str_ortvalue

Displays the content of an C_OrtValue.

unreduced_onnx_loss

Every loss function reduces the results to compute a loss. The score function needs to get the loss for every observation, …