class_docstr: Nonlinear transform coding model.
code: def train_losses(self, x):
      _, x_hat, rates = self.encode_decode(
          x, self.dither[0], self.dither[1], self.soft_round[0]
      )
      distortions = self.distortion_fn(x, x_hat)
      return rates, distortions
  
imports: import matplotlib.pyplot
  import numpy
  import tensorflow
  import tensorflow_compression
  import tensorflow_probability
  from toy_sources import compression_model
label_desc: Use image node_id 12 for calling the NTCModel obj's underlying member method code with example usage: obj.train_losses(x) and returns: rates,  distortions