fn
cross_entropy_op
→TensorImplPtrint cross_entropy_op(const int & input, const int & target, const int & weight_or_null, int reduction, double eps, int ignore_index)Python wrappers
Public Python APIs implemented by this engine symbol.Public cross-entropy (fused log-softmax + NLL) entry point.
Parameters
inputTensorImplPtrLogits of shape
(N, C) or (N, C, d_1, ...).targetTensorImplPtrInteger class labels of shape
(N,) or (N, d_1, ...).weight_or_nullTensorImplPtrOptional per-class weight vector of length ; pass null when unused.
reductionint0 (None), 1 (Mean), or 2 (Sum).epsdoubleNumerical clamp passed through to the backend.
ignore_indexintClass index excluded from the loss and gradient.
Returns
TensorImplPtrScalar (Mean / Sum) or per-sample (None) loss tensor.