class_docstr: An abstract interface for loss wrappers that allows flexible control of
  real examples, adversarial examples and labels. These losses are used
  for defenses (during model training).
class_docstr_tok: ["An","abstract","interface","for","loss","wrappers","that","allows","flexible","control","of","real","examples",",","adversarial","examples","and","labels",".","These","losses","are","used","for","defenses","(","during","model","training",")","."]
docstr: Save loss in json format
docstr_tok: ["Save","loss","in","json","format"]
code: def save(self, path):
      """Save loss in json format"""
      json.dump(
          dict(loss=self.__class__.__name__, params=self.hparams),
          open(os.path.join(path, "loss.json"), "wb"),
      )
  
imports: import copy
  import json
  import os
  import warnings
  import numpy
  import tensorflow
  from cleverhans.attacks import Attack
  from cleverhans.compat import softmax_cross_entropy_with_logits
  from cleverhans.model import Model
  from cleverhans.utils import safe_zip
label_desc: Use image node_id 2 for calling the Loss obj's underlying member method code with example usage: obj.save(path) without return types