class_docstr: A version of BCEWithLogitsLoss where the pos_weight can be supplied dynamically in the `forward` call. 
class_docstr_tok: ["A","version","of","BCEWithLogitsLoss","where","the","pos_weight","can","be","supplied","dynamically","in","the","`","forward","`","call","."]
code: def __init__(
      self,
      weight: Optional[pt.Tensor] = None,
      size_average=None,
      reduce=None,
      reduction: str = "mean",
      pos_weight: Optional[pt.Tensor] = None,
  ) -> None:
      super().__init__(reduction=reduction)
      self.register_buffer("weight", weight)
      self.register_buffer("pos_weight", pos_weight)
      self.weight: Optional[pt.Tensor]
      self.pos_weight: Optional[pt.Tensor]
  
imports: import logging
  import math
  from abc import ABC, abstractmethod
  from typing import Any, Dict, Optional, Tuple
  import torch
  import numpy
  from .None import constants
  from .None import utils
label_desc: Use image node_id 1 to create a new DynamicBCEWithLogitsLoss object from inherited base classes: pt.nn with example: obj = DynamicBCEWithLogitsLoss(weight, size_average, reduce, reduction, pos_weight)