| 16 | namespace embedx { |
| 17 | |
| 18 | std::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 | |
| 37 | std::vector<GraphNode*> BinaryClassificationTarget(GraphNode* X, GraphNode* Y, |
| 38 | int has_w) { |
no outgoing calls
no test coverage detected