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

Function MultiClassificationTarget

src/model/encoder/target_encoder.cc:55–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55std::vector<GraphNode*> MultiClassificationTarget(const std::string& prefix,
56 GraphNode* X, int has_w) {
57 DXCHECK_THROW(X->shape().is_rank(2));
58 auto* Y = deepx_core::GetY(1);
59 auto* L = deepx_core::BatchSoftmaxCELoss(prefix + "L", X, Y);
60 auto* P = deepx_core::Softmax(prefix + "P", X);
61 if (has_w) {
62 auto* W = deepx_core::GetW(1);
63 auto* WL = deepx_core::Mul(prefix + "WL", L, W);
64 auto* WM = deepx_core::ReduceMean(prefix + "WM", WL);
65 return {WM, P};
66 } else {
67 auto* M = deepx_core::ReduceMean(prefix + "M", L);
68 return {M, P};
69 }
70}
71
72std::vector<GraphNode*> MultiClassificationTarget(GraphNode* X, int has_w) {
73 DXCHECK_THROW(X->shape().is_rank(2));

Callers 7

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