class_docstr: DrQ Torso inspired by the second DrQ paper [Yarats et al., 2021].
  
  [Yarats et al., 2021] https://arxiv.org/abs/2107.09645
class_docstr_tok: ["DrQ","Torso","inspired","by","the","second","DrQ","paper","[","Yarats","et","al.",",","2021","]",".","[","Yarats","et","al.",",","2021","]","https",":","\/\/arxiv.org\/abs\/2107.09645"]
code: def __init__(
      self,
      data_format: str = "NHWC",
      activation: Callable[[tf.Tensor], tf.Tensor] = tf.nn.relu,
      output_dtype: tf.DType = tf.float32,
      name: str = "resnet_torso",
  ):
      super().__init__(name=name)
  
      self._output_dtype = output_dtype
  
      # Create a Conv2D factory since we'll be making quite a few.
      gain = 2**0.5 if activation == tf.nn.relu else 1.0
  
      def build_conv_layer(
          name: str,
          output_channels: int = 32,
          kernel_shape: Sequence[int] = (3, 3),
          stride: int = 1,
      ):
          return snt.Conv2D(
              output_channels=output_channels,
              kernel_shape=kernel_shape,
              stride=stride,
              padding="SAME",
              data_format=data_format,
              w_init=snt.initializers.Orthogonal(gain=gain, seed=None),
              b_init=snt.initializers.Zeros(),
              name=name,
          )
  
      self._network = snt.Sequential(
          [
              build_conv_layer("conv_0", stride=2),
              activation,
              build_conv_layer("conv_1", stride=1),
              activation,
              build_conv_layer("conv_2", stride=1),
              activation,
              build_conv_layer("conv_3", stride=1),
              activation,
              snt.Flatten(),
          ]
      )
  
file_path: acme/acme/tf/networks/vision.py
imports: from typing import Callable, Optional, Sequence, Union
  import sonnet
  import tensorflow
label_desc: Use image node_id 1 to create a new DrQTorso object from inherited base classes: snt with example: obj = DrQTorso(data_format, activation, output_dtype, name)