class_docstr: Base class for coding experiment.
class_docstr_tok: ["Base","class","for","coding","experiment","."]
docstr: Computes the training losses for `x`.
  
  Args:
    x: A batch of source vectors.
  
  Returns:
    Either an RD loss value for each element in `x`, or a tuple which contains
    the rate and distortion losses for each element separately (as in
    `test_losses`).
docstr_tok: ["Computes","the","training","losses","for","`","x","`",".","Args",":","x",":","A","batch","of","source","vectors",".","Returns",":","Either","an","RD","loss","value","for","each","element","in","`","x","`",",","or","a","tuple","which","contains","the","rate","and","distortion","losses","for","each","element","separately","(","as","in","`","test_losses","`",")","."]
code: def train_losses(self, x):
      """Computes the training losses for `x`.
  
      Args:
        x: A batch of source vectors.
  
      Returns:
        Either an RD loss value for each element in `x`, or a tuple which contains
        the rate and distortion losses for each element separately (as in
        `test_losses`).
      """
  
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 4 for calling the CompressionModel obj's underlying member method code with example usage: obj.train_losses(x) without return types