| 148 | } |
| 149 | |
| 150 | torch::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 | |
| 157 | YOLOLossImpl::YOLOLossImpl(torch::Tensor anchors_, int num_classes_, int img_size_[], |
no test coverage detected