class_docstr: The base class that you should implement to calculate the custom loss function.
      
class_docstr_tok: ["The","base","class","that","you","should","implement","to","calculate","the","custom","loss","function","."]
docstr: Calculates the custom loss function.
  This function may use only the operations supported for autodiff:
  
  - simple arithmetic: `+ - * /`
  - the `neoml.AutoDiff.*` functions
  - `neoml.Autodiff.const` for creating additional blobs filled with given values
  
  :param neoml.Blob.Blob data: the network response with the probability 
  distribution of objects over classes. The blob dimensions:
  
  - **BatchLength** - the number of objects
  - **Channels** - the object size
  - all other dimensions equal to 1
  
  :param neoml.Blob.Blob labels: the correct labels, of the same dimensions
  as the first blob, and containing 1 in the coordinate of the class to which
  the corresponding object belongs, 0 in all other places.
  
  :return: a blob that contains the loss function values 
  for each object in the batch. This blob will have the same **BatchLength** 
  as the input blobs, and all its other dimensions should be 1.
  :rtype: `neoml.Blob.Blob`
docstr_tok: ["Calculates","the","custom","loss","function",".","This","function","may","use","only","the","operations","supported","for","autodiff",":","-","simple","arithmetic",":","`","+","-","*","\/","`","-","the","`","neoml.AutoDiff",".","*","`","functions","-","`","neoml.Autodiff.const","`","for","creating","additional","blobs","filled","with","given","values",":","param","neoml.Blob.Blob","data",":","the","network","response","with","the","probability","distribution","of","objects","over","classes",".","The","blob","dimensions",":","-","*","*","BatchLength","*","*","-","the","number","of","objects","-","*","*","Channels","*","*","-","the","object","size","-","all","other","dimensions","equal","to","1",":","param","neoml.Blob.Blob","labels",":","the","correct","labels",",","of","the","same","dimensions","as","the","first","blob",",","and","containing","1","in","the","coordinate","of","the","class","to","which","the","corresponding","object","belongs",",","0","in","all","other","places",".",":","return",":","a","blob","that","contains","the","loss","function","values","for","each","object","in","the","batch",".","This","blob","will","have","the","same","*","*","BatchLength","*","*","as","the","input","blobs",",","and","all","its","other","dimensions","should","be","1.",":","rtype",":","`","neoml.Blob.Blob","`"]
code: def calc(self, data, labels):
      """Calculates the custom loss function.
      This function may use only the operations supported for autodiff:
  
      - simple arithmetic: `+ - * /`
      - the `neoml.AutoDiff.*` functions
      - `neoml.Autodiff.const` for creating additional blobs filled with given values
  
      :param neoml.Blob.Blob data: the network response with the probability
      distribution of objects over classes. The blob dimensions:
  
      - **BatchLength** - the number of objects
      - **Channels** - the object size
      - all other dimensions equal to 1
  
      :param neoml.Blob.Blob labels: the correct labels, of the same dimensions
      as the first blob, and containing 1 in the coordinate of the class to which
      the corresponding object belongs, 0 in all other places.
  
      :return: a blob that contains the loss function values
      for each object in the batch. This blob will have the same **BatchLength**
      as the input blobs, and all its other dimensions should be 1.
      :rtype: `neoml.Blob.Blob`
      """
  
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 for calling the CustomLossCalculatorBase obj's underlying member method code with example usage: obj.calc(data, labels) without return types