class_docstr: Base class for coding experiment.
class_docstr_tok: ["Base","class","for","coding","experiment","."]
docstr: Computes the rate and distortion for each element of `x`.
  
  Args:
    x: A batch of source vectors.
  
  Returns:
    rates: For each element in `x`, the self-information in bits needed to
      encode it.
    distortions: The distortion loss for each element in `x`.
docstr_tok: ["Computes","the","rate","and","distortion","for","each","element","of","`","x","`",".","Args",":","x",":","A","batch","of","source","vectors",".","Returns",":","rates",":","For","each","element","in","`","x","`",",","the","self-information","in","bits","needed","to","encode","it",".","distortions",":","The","distortion","loss","for","each","element","in","`","x","`","."]
code: def test_losses(self, x):
      """Computes the rate and distortion for each element of `x`.
  
      Args:
        x: A batch of source vectors.
  
      Returns:
        rates: For each element in `x`, the self-information in bits needed to
          encode it.
        distortions: The distortion loss for each element in `x`.
      """
  
file_path: compression/models/toy_sources/compression_model.py
imports: import abc
  import matplotlib.pyplot
  import numpy
  import tensorflow
label_desc: Use image node_id 5 for calling the CompressionModel obj's underlying member method code with example usage: obj.test_losses(x) without return types