MCPcopy Create free account
hub / github.com/Tencent/embedx / MultiLabelClassificationTarget

Function MultiLabelClassificationTarget

src/model/encoder/target_encoder.cc:88–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88std::vector<GraphNode*> MultiLabelClassificationTarget(
89 const std::string& prefix, GraphNode* X, int has_w) {
90 DXCHECK_THROW(X->shape().is_rank(2));
91 auto* X1 = deepx_core::Reshape2("X1", X, Shape(-1, 1));
92 auto* Y = deepx_core::GetY(1);
93 auto* Y1 = deepx_core::Reshape2("Y1", Y, Shape(-1, 1));
94 auto* L = deepx_core::SigmoidBCELoss(prefix + "L", X1, Y1);
95 auto* P = deepx_core::Sigmoid(prefix + "P", X);
96 if (has_w) {
97 auto* W = deepx_core::GetW(1);
98 auto* WL = deepx_core::Mul(prefix + "WL", L, W);
99 auto* WM = deepx_core::ReduceMean(prefix + "WM", WL);
100 return {WM, P};
101 } else {
102 auto* M = deepx_core::ReduceMean(prefix + "M", L);
103 return {M, P};
104 }
105}
106
107std::vector<GraphNode*> MultiLabelClassificationTarget(GraphNode* X,
108 int has_w) {

Callers 3

InitGraphMethod · 0.85
InitGraphMethod · 0.85
InitGraphMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected