class_docstr: Main model class.
docstr: Compresses an image.
docstr_tok: ["Compresses","an","image","."]
code: def compress(self, x):
      """Compresses an image."""
      # Add batch dimension and cast to float.
      x = tf.expand_dims(x, 0)
      x = tf.cast(x, dtype=self.compute_dtype)
      y = self.analysis_transform(x)
      z = self.hyper_analysis_transform(abs(y))
      # Preserve spatial shapes of image and latents.
      x_shape = tf.shape(x)[1:-1]
      y_shape = tf.shape(y)[1:-1]
      z_shape = tf.shape(z)[1:-1]
      z_hat = self.side_entropy_model.quantize(z)
      indexes = self.hyper_synthesis_transform(z_hat)
      indexes = indexes[:, : y_shape[0], : y_shape[1], :]
      side_string = self.side_entropy_model.compress(z)
      string = self.entropy_model.compress(y, indexes)
      return string, side_string, x_shape, y_shape, z_shape
  
imports: import argparse
  import glob
  import sys
  from absl import app
  from absl.flags import argparse_flags
  import tensorflow
  import tensorflow_compression
  import tensorflow_datasets
label_desc: Use image node_id 8 for calling the BMSHJ2018Model obj's underlying member method code with example usage: obj.compress(x) and returns: string,  side_string,  x_shape,  y_shape,  z_shape