class_docstr: Main model class.
class_docstr_tok: ["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)
      # Preserve spatial shapes of both image and latents.
      x_shape = tf.shape(x)[1:-1]
      y_shape = tf.shape(y)[1:-1]
      return self.entropy_model.compress(y), x_shape, y_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 BLS2017Model obj's underlying member method code with example usage: obj.compress(x) and returns: self,  x_shape,  y_shape