def maybe_update_alpha():
      """Maybe update the alpha param.

      Checks if global_step is between begin_compression_step and
      end_compression_step, and if the current training step is a
      compression step.

      Returns:
        Boolean tensor whether the training step is a compression step.
      """
      is_step_within_compression_range = tf.logical_and(
          tf.greater_equal(
              tf.cast(self._global_step, tf.int32),
              self._spec.begin_compression_step),
          tf.logical_or(
              tf.less_equal(
                  tf.cast(self._global_step, tf.int32),
                  self._spec.end_compression_step),
              tf.less(self._spec.end_compression_step, 0)))
      is_compression_step = tf.less_equal(
          tf.add(self.last_alpha_update_step, self._spec.compression_frequency),
          tf.cast(self._global_step, tf.int32))
      return tf.logical_and(is_step_within_compression_range,
                            is_compression_step)