docstr: Apply log compression to a field.
  
  By default: input[field] = log(1.0 + input[field])
  For clamp mode: input[field] = log(max(log_zero_guard_value, input[field]))
  
  Args:
      field: Field to apply log compression to.
      log_zero_guard_type: Method to avoid logarithm approaching -inf, either "add" or "clamp".
      log_zero_guard_value: Value to add or clamp input with.
docstr_tok: ["Apply","log","compression","to","a","field",".","By","default",":","input","[","field","]","=","log","(","1.0","+","input","[","field","]",")","For","clamp","mode",":","input","[","field","]","=","log","(","max","(","log_zero_guard_value",",","input","[","field","]",")",")","Args",":","field",":","Field","to","apply","log","compression","to",".","log_zero_guard_type",":","Method","to","avoid","logarithm","approaching","-inf",",","either","``","add","''","or","``","clamp","''",".","log_zero_guard_value",":","Value","to","add","or","clamp","input","with","."]
code: def __init__(
      self,
      field: str,
      log_zero_guard_type: str = "add",
      log_zero_guard_value: float = 1.0,
  ):
      """
      Apply log compression to a field.
  
      By default: input[field] = log(1.0 + input[field])
      For clamp mode: input[field] = log(max(log_zero_guard_value, input[field]))
  
      Args:
          field: Field to apply log compression to.
          log_zero_guard_type: Method to avoid logarithm approaching -inf, either "add" or "clamp".
          log_zero_guard_value: Value to add or clamp input with.
      """
  
      self.field = field
  
      if log_zero_guard_type == "add":
          self.guard_fn = self._add_guard
      elif log_zero_guard_type == "clamp":
          self.guard_fn = self._clamp_guard
      else:
          raise ValueError(
              f"Unsupported log zero guard type: '{log_zero_guard_type}'"
          )
  
      self.guard_type = log_zero_guard_type
      self.guard_value = log_zero_guard_value
  
imports: import json
  from abc import ABC, abstractmethod
  from pathlib import Path
  from typing import Optional
  import torch
  from nemo.utils.decorators import experimental
label_desc: Use image node_id 1 to create a new LogCompression object from inherited base classes: FeatureProcessor with example: obj = LogCompression(field, log_zero_guard_type, log_zero_guard_value)