Skip to content

Commit 3dabf4e

Browse files
committed
feat: add multilabel_margin_loss_forward_output base
1 parent 57ec7e3 commit 3dabf4e

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#ifndef INFINI_OPS_BASE_MULTILABEL_MARGIN_LOSS_FORWARD_OUTPUT_H_
2+
#define INFINI_OPS_BASE_MULTILABEL_MARGIN_LOSS_FORWARD_OUTPUT_H_
3+
4+
#include "operator.h"
5+
6+
namespace infini::ops {
7+
8+
class MultilabelMarginLossForwardOutput
9+
: public Operator<MultilabelMarginLossForwardOutput> {
10+
public:
11+
MultilabelMarginLossForwardOutput(const Tensor self, const Tensor target,
12+
const int64_t reduction, Tensor output,
13+
Tensor is_target)
14+
: self_shape_{self.shape()},
15+
self_strides_{self.strides()},
16+
self_type_{self.dtype()},
17+
target_shape_{target.shape()},
18+
target_strides_{target.strides()},
19+
target_type_{target.dtype()},
20+
output_shape_{output.shape()},
21+
output_strides_{output.strides()},
22+
output_type_{output.dtype()},
23+
is_target_shape_{is_target.shape()},
24+
is_target_strides_{is_target.strides()},
25+
is_target_type_{is_target.dtype()},
26+
device_index_{output.device().index()} {}
27+
28+
virtual void operator()(const Tensor self, const Tensor target,
29+
const int64_t reduction, Tensor output,
30+
Tensor is_target) const = 0;
31+
32+
protected:
33+
Tensor::Shape self_shape_;
34+
Tensor::Strides self_strides_;
35+
DataType self_type_;
36+
Tensor::Shape target_shape_;
37+
Tensor::Strides target_strides_;
38+
DataType target_type_;
39+
Tensor::Shape output_shape_;
40+
Tensor::Strides output_strides_;
41+
DataType output_type_;
42+
Tensor::Shape is_target_shape_;
43+
Tensor::Strides is_target_strides_;
44+
DataType is_target_type_;
45+
int device_index_{0};
46+
};
47+
48+
} // namespace infini::ops
49+
50+
#endif

0 commit comments

Comments
 (0)