class_docstr: Transformer with strided convolutions.
class_docstr_tok: ["Transformer","with","strided","convolutions","."]
docstr: Add layers of strided convolutions on top of encoder.
docstr_tok: ["Add","layers","of","strided","convolutions","on","top","of","encoder","."]
code: def encode(
      self, inputs, target_space, hparams, features=None, losses=None
  ):
      """Add layers of strided convolutions on top of encoder."""
      with tf.variable_scope("downstride"):
          hparams = self.hparams
          kernel, strides = (4, 4), (2, 2)
          x = inputs
          # Down-convolutions.
          for i in range(hparams.num_compress_steps):
              x = common_layers.make_even_size(x)
              x = tf.layers.conv2d(
                  x,
                  hparams.hidden_size,
                  kernel,
                  strides=strides,
                  padding="SAME",
                  activation=common_layers.belu,
                  name="conv_%d" % i,
              )
              x = common_layers.layer_norm(x)
  
      encoder_output, encoder_decoder_attention_bias = super(
          TransformerSketch, self
      ).encode(
          x, target_space, hparams, features=features, losses=losses
      )
      return encoder_output, encoder_decoder_attention_bias
  
file_path: tensor2tensor/tensor2tensor/models/research/transformer_sketch.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from tensor2tensor.layers import common_layers
  from tensor2tensor.models import transformer
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
label_desc: Use image node_id 1 for calling the TransformerSketch obj's underlying member method code with example usage: obj.encode(inputs, target_space, hparams, features, losses) and returns: encoder_output,  encoder_decoder_attention_bias