docstr: Compute focal loss for binary classification problem.
  Args:
      inputs: [B,C,H,W]
      targets: [B,C,H,W] one-hot or [B,H,W] long tensor that will be one-hot encoded (w.r.t to ignore_index)
  
  Returns:
docstr_tok: ["Compute","focal","loss","for","binary","classification","problem",".","Args",":","inputs",":","[","B",",","C",",","H",",","W","]","targets",":","[","B",",","C",",","H",",","W","]","one-hot","or","[","B",",","H",",","W","]","long","tensor","that","will","be","one-hot","encoded","(","w.r.t","to","ignore_index",")","Returns",":"]
code: def forward(self, inputs: Tensor, targets: Tensor) -> Tensor:
      """
      Compute focal loss for binary classification problem.
      Args:
          inputs: [B,C,H,W]
          targets: [B,C,H,W] one-hot or [B,H,W] long tensor that will be one-hot encoded (w.r.t to ignore_index)
  
      Returns:
  
      """
  
      if len(targets.shape) + 1 == len(inputs.shape):
          targets = self.get_one_hot_targets(
              targets, num_classes=inputs.size(1)
          )
  
      loss = self.focal_loss_fn(inputs, targets)
      return loss
  
file_path: pytorch-toolbelt/pytorch_toolbelt/losses/focal.py
imports: from functools import partial
  from typing import Optional
  import torch
  from torch import Tensor, nn
  from torch.nn.modules.loss import _Loss
  from .functional import focal_loss_with_logits, softmax_focal_loss_with_logits
  from pytorch_toolbelt.utils import pytorch_toolbelt_deprecated
label_desc: Use image node_id 3 for calling the BinaryFocalLoss obj's underlying member method code with example usage: obj.forward(inputs, targets) and returns: loss