include_tensor_kernels.h#

namespace ONNX_LIGHT_NAMESPACE
namespace onnx_backend_test
namespace kernel
class Cast#
#include <include_tensor_kernels.h>

Performs element-wise type conversion of an input tensor x to the data type specified by to (a TensorProto::DataType value, mirroring the Cast operator’s required to attribute). The output shape always matches the input shape.

The reference implementation supports the four most widely used numeric element types in the backend test library: FLOAT, DOUBLE, INT32 and INT64 (and a no-op when to equals the input dtype). Other dtypes will cause the kernel to throw std::invalid_argument: this is sufficient for the backend test cases registered today and keeps the implementation small. Out-of-range floating-point values when casting to an integer dtype follow C++ static_cast semantics, which matches the behaviour exercised by the upstream test_cast_FLOAT_to_* node tests for the supported conversions.

Public Functions

inline explicit Cast(const KernelContext &ctx)#
Tensor operator()(const Tensor &x, int32_t to) const#
void operator()(const Tensor &x, int32_t to, Tensor &output) const#

Public Static Functions

static inline constexpr bool CanRunInPlace() noexcept#

Output element type may differ from the input element type, so storage can not be shared in general.

Private Members

KernelContext ctx_#
class Concat#
#include <include_tensor_kernels.h>

Concatenates a list of tensors along axis (since opset 13). All input tensors must share the same data type and the same shape except along the concatenation axis. axis may be negative, in which case it counts from the back of the input rank.

Public Functions

inline explicit Concat(const KernelContext &ctx)#
Tensor operator()(const std::vector<Tensor> &inputs, int64_t axis) const#
void operator()(const std::vector<Tensor> &inputs, int64_t axis, Tensor &output) const#

Public Static Functions

static inline constexpr bool CanRunInPlace() noexcept#

Private Members

KernelContext ctx_#