class_docstr: References:
      Author: clcarwin
      Site https://github.com/clcarwin/focal_loss_pytorch/blob/master/focalloss.py
class_docstr_tok: ["References",":","Author",":","clcarwin","Site","https",":","\/\/github.com\/clcarwin\/focal_loss_pytorch\/blob\/master\/focalloss.py"]
code: def __init__(self, gamma=0, alpha=None, size_average=True):
      super(FocalLoss, self).__init__()
      self.gamma = gamma
      self.alpha = alpha
      if isinstance(alpha, (float, int)):
          self.alpha = torch.Tensor([alpha, 1 - alpha])
      if isinstance(alpha, list):
          self.alpha = torch.Tensor(alpha)
      self.size_average = size_average
  
file_path: baal/experiments/segmentation/utils.py
imports: from typing import List
  import numpy
  import segmentation_models_pytorch
  from segmentation_models_pytorch.base.modules import Activation
  import torch
  from torch import nn
  from torch.nn import functional
  from torchvision import datasets
  from torchvision.transforms import transforms
  from baal import ActiveLearningDataset
label_desc: Use image node_id 1 to create a new FocalLoss object from inherited base classes: nn with example: obj = FocalLoss(gamma, alpha, size_average)