MCPcopy Create free account
hub / github.com/AllentDan/LibtorchTutorials / BCELoss

Function BCELoss

lesson7-Detection/src/models/yolo_training.cpp:150–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150torch::Tensor BCELoss(torch::Tensor pred, torch::Tensor target) {
151 pred = clip_by_tensor(pred, 1e-7, 1.0 - 1e-7);
152 auto output = -target * torch::log(pred) - (1.0 - target) * torch::log(1.0 - pred);
153 return output;
154}
155
156
157YOLOLossImpl::YOLOLossImpl(torch::Tensor anchors_, int num_classes_, int img_size_[],

Callers 1

forwardMethod · 0.85

Calls 1

clip_by_tensorFunction · 0.85

Tested by

no test coverage detected