shape_training.h#
Shape-inference functions for ONNX operators in the ai.onnx.preview.training (training) family.
-
namespace onnx_light
Alias that makes onnx-light headers compatible with code that references
ONNX_LIGHT_NAMESPACE(the macro used in the standard onnx package).Set to
ONNX_LIGHT_NAMESPACEso both names resolve to the same namespace.Symbol-visibility attribute for the public onnx-light C++ API.
Defined as empty because onnx-light does not require explicit
__declspec(dllexport)or__attribute__((visibility("default")))annotations — visibility is controlled at the shared-library level. The macro is provided so that vendored ONNX headers that decorate their declarations withONNX_APIcompile without modification.Namespace alias so that ONNX C++ code (and consumers such as onnxruntime) that refers to the literal
onnxnamespace — rather than theONNX_NAMESPACEmacro — resolves to the onnx-light namespace. The standard onnx package lives innamespace onnx; onnx-light usesonnx_light(via ONNX_LIGHT_NAMESPACE), so this alias keeps onnx-light a true drop-in. It is only introduced when the onnx-light namespace differs fromonnx.-
namespace onnx_optim#
-
namespace shapes#
-
namespace training#
Functions
-
void ComputeShapeAdam(ShapesContext &ctx, const NodeProto &node)#
Computes the output :cpp:class:
OptimTensorof anAdamnode and stores it inctx.Adam(ai.onnx.preview.training) updatesNoptimised tensors and their accumulated first / second moments. The input list has the shape[R, T, X_1, ..., X_N, G_1, ..., G_N, V_1, ..., V_N, H_1, ..., H_N](soinput_size == 2 + 4 * N) and the output list has the shape[X_1_new, ..., X_N_new, V_1_new, ..., V_N_new, H_1_new, ..., H_N_new](sooutput_size == 3 * N).Each
*_newoutput mirrors the dtype and shape of the correspondingX_i/V_i/H_iinput.- Parameters:
ctx – In/out context. Must already contain entries for every
X_i,V_iandH_iinput read fromnode; on return it also contains an entry for every output ofnode.node – The
AdamNodeProtowhose outputs should be described.node.op_type()must be"Adam",node.input_size()must be2 + 4 * Nfor someN >= 1andnode.output_size()must be3 * N.
- Throws:
-
void ComputeShapeAdagrad(ShapesContext &ctx, const NodeProto &node)#
Computes the output :cpp:class:
OptimTensorof anAdagradnode and stores it inctx.Adagrad(ai.onnx.preview.training) updatesNoptimised tensors and their accumulated squared gradients. The input list has the shape[R, T, X_1, ..., X_N, G_1, ..., G_N, H_1, ..., H_N](soinput_size == 2 + 3 * N) and the output list has the shape[X_1_new, ..., X_N_new, H_1_new, ..., H_N_new](sooutput_size == 2 * N).Each
X_i_new/H_i_newoutput mirrors the dtype and shape of the correspondingX_i/H_iinput.- Parameters:
ctx – In/out context. Must already contain entries for every
X_iandH_iinput read fromnode; on return it also contains an entry for every output ofnode.node – The
AdagradNodeProtowhose outputs should be described.node.op_type()must be"Adagrad",node.input_size()must be2 + 3 * Nfor someN >= 1andnode.output_size()must be2 * N.
- Throws:
-
void ComputeShapeMomentum(ShapesContext &ctx, const NodeProto &node)#
Computes the output :cpp:class:
OptimTensorof aMomentumnode and stores it inctx.Momentum(ai.onnx.preview.training) updatesNoptimised tensors and their accumulated momenta. The input list has the shape[R, T, X_1, ..., X_N, G_1, ..., G_N, V_1, ..., V_N](soinput_size == 2 + 3 * N) and the output list has the shape[X_1_new, ..., X_N_new, V_1_new, ..., V_N_new](sooutput_size == 2 * N).Each
X_i_new/V_i_newoutput mirrors the dtype and shape of the correspondingX_i/V_iinput.- Parameters:
ctx – In/out context. Must already contain entries for every
X_iandV_iinput read fromnode; on return it also contains an entry for every output ofnode.node – The
MomentumNodeProtowhose outputs should be described.node.op_type()must be"Momentum",node.input_size()must be2 + 3 * Nfor someN >= 1andnode.output_size()must be2 * N.
- Throws:
Variables
-
constexpr const char *kOnnxPreviewTrainingDomain = "ai.onnx.preview.training"#
Canonical domain string for the
ai.onnx.preview.trainingoperator set.
-
void ComputeShapeAdam(ShapesContext &ctx, const NodeProto &node)#
-
namespace training#
-
namespace shapes#
-
namespace onnx_optim#