class_docstr: Calcualte LPIPS loss.
class_docstr_tok: ["Calcualte","LPIPS","loss","."]
code: def __init__(self, weight_path):
      helpers.ensure_lpips_weights_exist(weight_path)
  
      def wrap_frozen_graph(graph_def, inputs, outputs):
          def _imports_graph_def():
              tf.graph_util.import_graph_def(graph_def, name="")
  
          wrapped_import = tf.compat.v1.wrap_function(
              _imports_graph_def, []
          )
          import_graph = wrapped_import.graph
          return wrapped_import.prune(
              tf.nest.map_structure(
                  import_graph.as_graph_element, inputs
              ),
              tf.nest.map_structure(
                  import_graph.as_graph_element, outputs
              ),
          )
  
      # Pack LPIPS network into a tf function
      graph_def = tf.compat.v1.GraphDef()
      with open(weight_path, "rb") as f:
          graph_def.ParseFromString(f.read())
      self._lpips_func = tf.function(
          wrap_frozen_graph(
              graph_def, inputs=("0:0", "1:0"), outputs="Reshape_10:0"
          )
      )
  
imports: import collections
  import glob
  import itertools
  from compare_gan.gans import loss_lib
  import tensorflow.compat.v1
  import tensorflow_datasets
  from hific import archs
  from hific import helpers
  from hific.helpers import ModelMode
  from hific.helpers import ModelType
  from hific.helpers import TFDSArguments
label_desc: Use image node_id 1 to create a new LPIPSLoss object from inherited base classes: object with example: obj = LPIPSLoss(weight_path)