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

Function BinaryClassificationTarget

src/model/encoder/target_encoder.cc:18–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16namespace embedx {
17
18std::vector<GraphNode*> BinaryClassificationTarget(const std::string& prefix,
19 GraphNode* X, GraphNode* Y,
20 int has_w) {
21 DXCHECK_THROW(X->shape().is_rank(2));
22 DXCHECK_THROW(X->shape()[1] == 1);
23 DXCHECK_THROW(Y->shape()[1] == 1);
24 auto* L = deepx_core::SigmoidBCELoss(prefix + "L", X, Y);
25 auto* P = deepx_core::Sigmoid(prefix + "P", X);
26 if (has_w) {
27 auto* W = deepx_core::GetW(1);
28 auto* WL = deepx_core::Mul(prefix + "WL", L, W);
29 auto* WM = deepx_core::ReduceMean(prefix + "WM", WL);
30 return {WM, P};
31 } else {
32 auto* M = deepx_core::ReduceMean(prefix + "M", L);
33 return {M, P};
34 }
35}
36
37std::vector<GraphNode*> BinaryClassificationTarget(GraphNode* X, GraphNode* Y,
38 int has_w) {

Callers 13

InitGraphMethod · 0.85
InitGraphMethod · 0.85
InitGraphMethod · 0.85
InitGraphMethod · 0.85
InitGraphMethod · 0.85
InitGraphMethod · 0.85
InitGraphMethod · 0.85
InitGraphMethod · 0.85
InitGraphMethod · 0.85
InitGraphMethod · 0.85
InitGraphMethod · 0.85
InitGraphMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected