1#ifndef INFINI_OPS_BASE_BINARY_CROSS_ENTROPY_H_
2#define INFINI_OPS_BASE_BINARY_CROSS_ENTROPY_H_
7#include "common/op_utils/reduction.h"
15 const std::optional<Tensor> weight,
16 const std::optional<bool> size_average,
17 const std::optional<bool> reduce,
18 const std::string reduction,
Tensor out)
33 weight_type_{weight ? weight->dtype() : DataType::kFloat32},
34 reduction_{reduction_detail::FromPythonArguments(size_average, reduce,
40 [[deprecated(
"Use the Python-compatible reduction overload instead.")]]
42 const std::optional<Tensor> weight,
43 const int64_t reduction,
Tensor out)
58 weight_type_{weight ? weight->dtype() : DataType::kFloat32},
63 const std::optional<Tensor> weight,
64 const std::optional<bool> size_average,
65 const std::optional<bool> reduce,
const std::string reduction,
68 input, target, weight,
69 reduction_detail::FromPythonArguments(size_average, reduce, reduction),
75 [[deprecated(
"Use the Python-compatible reduction overload instead.")]]
77 const std::optional<Tensor> weight,
78 const int64_t reduction,
Tensor out)
const = 0;
Definition binary_cross_entropy.h:12
DataType weight_type_
Definition binary_cross_entropy.h:105
Tensor::Strides input_strides_
Definition binary_cross_entropy.h:83
Tensor::Strides weight_strides_
Definition binary_cross_entropy.h:103
DataType target_type_
Definition binary_cross_entropy.h:91
Tensor::Shape target_shape_
Definition binary_cross_entropy.h:87
Tensor::Strides out_strides_
Definition binary_cross_entropy.h:95
Tensor::Strides target_strides_
Definition binary_cross_entropy.h:89
virtual void operator()(const Tensor input, const Tensor target, const std::optional< Tensor > weight, const int64_t reduction, Tensor out) const =0
int device_index_
Definition binary_cross_entropy.h:109
void operator()(const Tensor input, const Tensor target, const std::optional< Tensor > weight, const std::optional< bool > size_average, const std::optional< bool > reduce, const std::string reduction, Tensor out) const
Definition binary_cross_entropy.h:62
BinaryCrossEntropy(const Tensor input, const Tensor target, const std::optional< Tensor > weight, const int64_t reduction, Tensor out)
Definition binary_cross_entropy.h:41
DataType out_type_
Definition binary_cross_entropy.h:97
int64_t reduction_
Definition binary_cross_entropy.h:107
DataType input_type_
Definition binary_cross_entropy.h:85
Tensor::Shape weight_shape_
Definition binary_cross_entropy.h:101
Tensor::Shape out_shape_
Definition binary_cross_entropy.h:93
BinaryCrossEntropy(const Tensor input, const Tensor target, const std::optional< Tensor > weight, const std::optional< bool > size_average, const std::optional< bool > reduce, const std::string reduction, Tensor out)
Definition binary_cross_entropy.h:14
bool has_weight_
Definition binary_cross_entropy.h:99
Tensor::Shape input_shape_
Definition binary_cross_entropy.h:81
Definition generated/include/operator.h:282
Definition generated/include/operator.h:28
infini::rt::TensorView Tensor
Definition tensor.h:8