elementwise_helpers.h#
-
namespace ONNX_LIGHT_NAMESPACE
-
namespace onnx_backend_test
-
namespace kernel#
-
namespace detail#
Functions
-
BroadcastInfo CheckBinaryBroadcast(const char *op_name, const char *dtype_name, int32_t expected_dtype, const Tensor &x, const Tensor &y)#
Verifies both inputs have
expected_dtypeand that their shapes are equal or broadcastable via scalar broadcasting (one side has a single element). Throwsstd::invalid_argumentotherwise.
-
void CheckPreallocatedOutput(const char *op_name, const char *dtype_name, int32_t expected_dtype, const std::vector<int64_t> &expected_shape, size_t expected_bytes, const Tensor &output)#
Verifies the caller-supplied preallocated output tensor matches the expected dtype, shape and byte buffer size.
-
template<typename TIn, typename TOut, typename Op>
void BinaryElementwise(const char *op_name, const char *dtype_name, int32_t expected_dtype, const Tensor &x, const Tensor &y, Tensor &output, Op op)# In-place element-wise binary kernel driver. Validates inputs + output then invokes
op(a, b) -> TOutfor each element pair (with scalar broadcasting).TInandTOutmust match the byte layout of theexpected_dtype.
-
template<typename TIn, typename TOut, typename Op>
Tensor BinaryElementwiseAlloc(const char *op_name, const char *dtype_name, int32_t expected_dtype, const Tensor &x, const Tensor &y, Op op)# Allocating element-wise binary kernel driver. Builds the output tensor with the broadcasted shape and
expected_dtype, then delegates to :cpp:func:BinaryElementwiseto fill it in.
-
struct BroadcastInfo#
- #include <elementwise_helpers.h>
Information about a validated binary broadcast: the output shape, total element count, and the individual input element counts (used by the loop to apply scalar broadcasting).
-
BroadcastInfo CheckBinaryBroadcast(const char *op_name, const char *dtype_name, int32_t expected_dtype, const Tensor &x, const Tensor &y)#
-
namespace detail#
-
namespace kernel#
-
namespace onnx_backend_test