class_docstr: CLIP image encoder.
class_docstr_tok: ["CLIP","image","encoder","."]
code: def __call__(
      self,
      image: jnp.ndarray,
      *,
      train: bool = False,
      debug: bool = False,
  ) -> jnp.ndarray:
      config = clip_model.CONFIGS[self.config_name]
  
      # We leave the default eps because the BatchNorm and LayerNorm are always
      # computed in FP32.
      if isinstance(config["vision_num_layers"], (tuple, list)):
          clip_image_encoder = clip_layers.ModifiedResNet(
              num_layers=config["vision_num_layers"],
              features=config["vision_features"],
              num_heads=config["vision_features"] * 32 // 6,
              out_features=(
                  None
                  if config.get("vision_return_map")
                  else config["embed_dim"]
              ),
              # dtype=self.dtype,
              name="visual",
          )
      else:
          clip_image_encoder = clip_layers.VisionTransformer(
              patch_size=config["vision_patch_size"],
              features=config["vision_features"],
              num_layers=config["vision_num_layers"],
              num_heads=config["vision_features"] // 64,
              out_features=(
                  None
                  if config.get("vision_return_map")
                  else config["embed_dim"]
              ),
              # dtype=self.dtype,
              name="visual",
          )
  
      x, feature_map = clip_image_encoder(image)
  
      if self.return_all_tokens:
          # We leave the default eps because the LayerNorm is always computed in
          # FP32.
          return nn.LayerNorm(epsilon=1e-5, dtype=self.dtype)(
              feature_map
          )
      else:
          if self.normalize:
              eps = jnp.finfo(x.dtype).eps
              return x / (
                  jnp.linalg.norm(x, axis=-1, keepdims=True) + eps
              )
          else:
              return x
  
file_path: scenic/scenic/projects/lang4video/model/clip.py
imports: from typing import Optional
  import flax
  from flax import linen
  from flax.core.frozen_dict import FrozenDict
  import jax
  import jax.numpy
  from scenic.projects.baselines.clip import layers
  from scenic.projects.baselines.clip import model
  from scenic.projects.lang4video.model.base_encoders import ImageEncoder
  from scenic.projects.lang4video.model.base_encoders import TextEncoder
label_desc: Use image node_id 1 for calling the ClipImageEncoder obj's underlying member method code with example usage: obj.__call__(image) and returns: nn, unknown, x