test_case.h#
-
namespace ONNX_LIGHT_NAMESPACE
-
namespace onnx_backend_test
Functions
-
inline OpsetId DefaultOpset(int64_t version)#
Builds an :ref:
OpsetIdfor the default ai.onnx domain (empty string).
-
void Expect(const NodeProto &node, const std::vector<Tensor> &inputs, const std::vector<Tensor> &outputs, const std::string &name, const std::vector<OpsetId> &opset_imports, const std::string &producer_name, std::vector<TestCase> ®istry)#
Builds a single-node
ModelProtofromnodeand the provided typed inputs/outputs, then appends aTestCasetoregistry.Mirrors
onnx_light.backend.test.case.base.expect(). Only the inputs and outputs whose name is non-empty in the node are wired into the graph.- Parameters:
node – Single-node template; its
op_type,domainandattributes are kept.inputs – Concrete input tensors corresponding to the non-empty entries of
node.input.outputs – Concrete expected output tensors corresponding to the non-empty entries of
node.output.name – Unique test name (used both for
TestCase.nameand the graph name).opset_imports – Opset imports for the generated model. If empty the caller is responsible for ensuring a default has been applied — typically pass at least
DefaultOpset(since_version).producer_name – Producer name written into the model.
registry – Output registry (appended to).
- Throws:
std::invalid_argument – if
inputs.size()does not equal the number of non-empty entries innode.inputor ifoutputs.size()does not equal the number of non-empty entries innode.output.
-
std::vector<TestCase> CollectTestCases()#
Collects all C++-implemented backend test node cases. Each call is deterministic and independent: the result owns its
ModelProtos andTensordata.- Returns:
A fresh registry of test cases (Abs, Add equal-shape, Add scalar broadcast).
-
struct DataSet#
- #include <test_case.h>
A single (inputs, expected outputs) data set associated with a TestCase.
-
struct OpsetId#
- #include <test_case.h>
Lightweight opset identifier used by the backend test library.
Mirrors the (domain, version) pair carried by
OperatorSetIdProtobut keeps the public API of this library independent from the proto type so test cases can be declared without touching the proto wire format.
-
struct TestCase#
- #include <test_case.h>
A backend test case mirroring
onnx_light.backend.test.case.base.TestCase. It bundles a single-nodeModelPrototogether with the expected input/ output data sets a runtime must reproduce.
-
inline OpsetId DefaultOpset(int64_t version)#
-
namespace onnx_backend_test