class_docstr: The layer that calculates a custom loss function.
  
  :param input_layers: the input layers to be connected. 
      The integer in each tuple specifies the number of the output.
      If not set, the first output will be used.
  :type input_layers: list of object, tuple(object, int)
  :param neoml.Dnn.CustomLossCalculatorBase loss_calculator: a user-implemented object 
      that provides the method to calculate the custom loss.
  :param loss_weight: the multiplier for the loss function value during training.
  :type loss_weight: float, default=1.0
  :param name: the layer name.
  :type name: str, default=None
  
  .. rubric:: Layer inputs:
  
  (1) the network response for which you are calculating the loss.
      It should contain the probability distribution for objects over classes.
      If you are not going to apply softmax in this layer, each element should already be >= 0, 
      and the sum over **Height** * **Width** * **Depth** * **Channels** dimension should be equal to 1.
      The dimensions:
  
      - **BatchLength** * **BatchWidth** * **ListSize** - the number of objects
      - **Height** * **Width** * **Depth** * **Channels** - the number of classes
  
  (2) the correct class labels. The blob of the same dimensions as the first input, 
      filled with zeros, where only the coordinate of the class to which 
      the corresponding object from the first input belongs is be 1.
  
  (3) (optional): the objects' weights.
      The dimensions:
  
      - **BatchLength**, **BatchWidth**, **ListSize** should be the same as for the first input
      - the other dimensions should be 1
  
  .. rubric:: Layer outputs:
  
  The layer has no output.
class_docstr_tok: ["The","layer","that","calculates","a","custom","loss","function",".",":","param","input_layers",":","the","input","layers","to","be","connected",".","The","integer","in","each","tuple","specifies","the","number","of","the","output",".","If","not","set",",","the","first","output","will","be","used",".",":","type","input_layers",":","list","of","object",",","tuple","(","object",",","int",")",":","param","neoml.Dnn.CustomLossCalculatorBase","loss_calculator",":","a","user-implemented","object","that","provides","the","method","to","calculate","the","custom","loss",".",":","param","loss_weight",":","the","multiplier","for","the","loss","function","value","during","training",".",":","type","loss_weight",":","float",",","default=1.0",":","param","name",":","the","layer","name",".",":","type","name",":","str",",","default=None","..","rubric",":",":","Layer","inputs",":","(","1",")","the","network","response","for","which","you","are","calculating","the","loss",".","It","should","contain","the","probability","distribution","for","objects","over","classes",".","If","you","are","not","going","to","apply","softmax","in","this","layer",",","each","element","should","already","be",">","=","0",",","and","the","sum","over","*","*","Height","*","*","*","*","*","Width","*","*","*","*","*","Depth","*","*","*","*","*","Channels","*","*","dimension","should","be","equal","to","1",".","The","dimensions",":","-","*","*","BatchLength","*","*","*","*","*","BatchWidth","*","*","*","*","*","ListSize","*","*","-","the","number","of","objects","-","*","*","Height","*","*","*","*","*","Width","*","*","*","*","*","Depth","*","*","*","*","*","Channels","*","*","-","the","number","of","classes","(","2",")","the","correct","class","labels",".","The","blob","of","the","same","dimensions","as","the","first","input",",","filled","with","zeros",",","where","only","the","coordinate","of","the","class","to","which","the","corresponding","object","from","the","first","input","belongs","is","be","1",".","(","3",")","(","optional",")",":","the","objects","'","weights",".","The","dimensions",":","-","*","*","BatchLength","*","*",",","*","*","BatchWidth","*","*",",","*","*","ListSize","*","*","should","be","the","same","as","for","the","first","input","-","the","other","dimensions","should","be","1","..","rubric",":",":","Layer","outputs",":","The","layer","has","no","output","."]
code: def __init__(
      self,
      input_layers,
      loss_calculator=None,
      loss_weight=1.0,
      name=None,
  ):
      if type(input_layers) is PythonWrapper.CustomLoss:
          super().__init__(input_layers)
          return
  
      layers, outputs = check_input_layers(input_layers, (2, 3))
  
      if not isinstance(loss_calculator, CustomLossCalculatorBase):
          raise ValueError(
              "The 'loss_calculator' must be a instance of neoml.CustomLossCalculatorBase."
          )
  
      internal = PythonWrapper.CustomLoss(
          loss_calculator,
          str(name),
          layers,
          outputs,
          float(loss_weight),
      )
      super().__init__(internal)
  
imports: import neoml.PythonWrapper
  from .Dnn import Layer
  from neoml.Utils import check_input_layers
  from abc import ABCMeta, abstractmethod
  import neoml.Blob
label_desc: Use image node_id 1 to create a new CustomLoss object from inherited base classes: Loss with example: obj = CustomLoss(input_layers, loss_calculator, loss_weight, name)