class_docstr: Bottleneck ResNet block.
class_docstr_tok: ["Bottleneck","ResNet","block","."]
code: def __call__(self, x: jnp.ndarray, train: bool = True) -> jnp.ndarray:
      needs_projection = x.shape[
          -1
      ] != self.filters * 4 or self.strides != (1, 1)
      nout = self.filters * 4 if self.bottleneck else self.filters
  
      batch_norm = functools.partial(
          nn.BatchNorm,
          use_running_average=not train,
          momentum=0.9,
          epsilon=1e-5,
          dtype=self.dtype,
      )
      conv = functools.partial(
          nn.Conv, use_bias=False, dtype=self.dtype
      )
  
      residual = x
      if needs_projection:
          residual = conv(nout, (1, 1), self.strides, name="proj_conv")(
              residual
          )
          residual = batch_norm(name="proj_bn")(residual)
  
      if self.bottleneck:
          x = conv(self.filters, (1, 1), name="conv1")(x)
          x = batch_norm(name="bn1")(x)
          x = nn_layers.IdentityLayer(name="relu1")(nn.relu(x))
  
      y = conv(
          self.filters,
          (3, 3),
          self.strides,
          padding=[(1, 1), (1, 1)],
          name="conv2",
      )(x)
      y = batch_norm(name="bn2")(y)
      y = nn_layers.IdentityLayer(name="relu2")(nn.relu(y))
  
      if self.bottleneck:
          y = conv(nout, (1, 1), name="conv3")(y)
      else:
          y = conv(
              nout, (3, 3), padding=[(1, 1), (1, 1)], name="conv3"
          )(y)
      y = batch_norm(name="bn3", scale_init=nn.initializers.zeros)(y)
      y = nn_layers.IdentityLayer(name="relu3")(nn.relu(residual + y))
      return y
  
imports: import functools
  from typing import Tuple, Callable, Any, Optional, Union, Dict
  from absl import logging
  import flax
  import flax.linen
  from jax.nn import initializers
  import jax.numpy
  import ml_collections
  from scenic.common_lib import debug_utils
  from scenic.model_lib.base_models.classification_model import ClassificationModel
  from scenic.model_lib.base_models.multilabel_classification_model import MultiLabelClassificationModel
  from scenic.model_lib.layers import nn_layers
label_desc: Use image node_id 1 for calling the ResidualBlock obj's underlying member method code with example usage: obj.__call__(x, train) and returns: y