class_docstr: ResNet model.
class_docstr_tok: ["ResNet","model","."]
docstr: Build the graph for cost from the logits if logits are provided.
  If predictions are provided, logits are extracted from the operation.
docstr_tok: ["Build","the","graph","for","cost","from","the","logits","if","logits","are","provided",".","If","predictions","are","provided",",","logits","are","extracted","from","the","operation","."]
code: def build_cost(self, labels, logits):
      """
      Build the graph for cost from the logits if logits are provided.
      If predictions are provided, logits are extracted from the operation.
      """
      op = logits.op
      if "softmax" in str(op).lower():
          (logits,) = op.inputs
  
      with tf.variable_scope("costs"):
          xent = tf.nn.softmax_cross_entropy_with_logits(
              logits=logits, labels=labels
          )
          cost = tf.reduce_mean(xent, name="xent")
          cost += self._decay()
          cost = cost
  
      return cost
  
imports: from collections import namedtuple
  import tensorflow
  import six
  from model import MLPnGPU
  from model import Conv2DnGPU
  from model import LinearnGPU
  from model import LayerNorm
label_desc: Use image node_id 6 for calling the ResNetTF obj's underlying member method code with example usage: obj.build_cost(labels, logits) and returns: cost