1#ifndef INFINI_OPS_BASE_NLL_LOSS_H_
2#define INFINI_OPS_BASE_NLL_LOSS_H_
7#include "common/op_utils/reduction.h"
15 const std::optional<Tensor> weight,
16 const std::optional<bool> size_average,
const int64_t ignore_index,
17 const std::optional<bool> reduce,
const std::string reduction,
33 weight_type_{weight ? weight->dtype() : DataType::kFloat32},
34 reduction_{reduction_detail::FromPythonArguments(size_average, reduce,
40 "Use the overload with `ignore_index` before string `reduction`.")]]
42 const std::optional<Tensor> weight,
const int64_t reduction,
43 const int64_t ignore_index,
Tensor out)
58 weight_type_{weight ? weight->dtype() : DataType::kFloat32},
64 const std::optional<Tensor> weight,
65 const std::optional<bool> size_average,
66 const int64_t ignore_index,
const std::optional<bool> reduce,
67 const std::string reduction,
Tensor out)
const {
69 input, target, weight,
70 reduction_detail::FromPythonArguments(size_average, reduce, reduction),
75 "Use the overload with `ignore_index` before string `reduction`.")]]
77 const std::optional<Tensor> weight,
78 const int64_t reduction,
const int64_t ignore_index,
NllLoss(const Tensor input, const Tensor target, const std::optional< Tensor > weight, const int64_t reduction, const int64_t ignore_index, Tensor out)
Definition nll_loss.h:41
int64_t reduction_
Definition nll_loss.h:108
int device_index_
Definition nll_loss.h:112
DataType out_type_
Definition nll_loss.h:98
Tensor::Strides weight_strides_
Definition nll_loss.h:104
DataType input_type_
Definition nll_loss.h:86
Tensor::Shape out_shape_
Definition nll_loss.h:94
void operator()(const Tensor input, const Tensor target, const std::optional< Tensor > weight, const std::optional< bool > size_average, const int64_t ignore_index, const std::optional< bool > reduce, const std::string reduction, Tensor out) const
Definition nll_loss.h:63
bool has_weight_
Definition nll_loss.h:100
DataType target_type_
Definition nll_loss.h:92
Tensor::Strides target_strides_
Definition nll_loss.h:90
Tensor::Strides out_strides_
Definition nll_loss.h:96
Tensor::Shape target_shape_
Definition nll_loss.h:88
Tensor::Shape weight_shape_
Definition nll_loss.h:102
Tensor::Shape input_shape_
Definition nll_loss.h:82
NllLoss(const Tensor input, const Tensor target, const std::optional< Tensor > weight, const std::optional< bool > size_average, const int64_t ignore_index, const std::optional< bool > reduce, const std::string reduction, Tensor out)
Definition nll_loss.h:14
int64_t ignore_index_
Definition nll_loss.h:110
virtual void operator()(const Tensor input, const Tensor target, const std::optional< Tensor > weight, const int64_t reduction, const int64_t ignore_index, Tensor out) const =0
DataType weight_type_
Definition nll_loss.h:106
Tensor::Strides input_strides_
Definition nll_loss.h:84
Definition generated/include/operator.h:282
Definition generated/include/operator.h:28
infini::rt::TensorView Tensor
Definition tensor.h:8