class_docstr: Visual representations using a torchvision model.
  
  ---
  name: Visual
docstr: Encode images with the given encoder and pooling methods.
  
  :param images: shape: (batch_size, num_channels, height, width)
      a batch of images
  :param encoder:
      the encoder, returning a dictionary with key "features"
  :param pool:
      the pooling method to use
  :return: shape: (batch_size, dim)
      the encoded representations.
docstr_tok: ["Encode","images","with","the","given","encoder","and","pooling","methods",".",":","param","images",":","shape",":","(","batch_size",",","num_channels",",","height",",","width",")","a","batch","of","images",":","param","encoder",":","the","encoder",",","returning","a","dictionary","with","key","``","features","''",":","param","pool",":","the","pooling","method","to","use",":","return",":","shape",":","(","batch_size",",","dim",")","the","encoded","representations","."]
code: def _encode(
      images: torch.FloatTensor,
      encoder: torch.nn.Module,
      pool: Callable[[torch.FloatTensor], torch.FloatTensor],
  ) -> torch.FloatTensor:
      """
      Encode images with the given encoder and pooling methods.
  
      :param images: shape: (batch_size, num_channels, height, width)
          a batch of images
      :param encoder:
          the encoder, returning a dictionary with key "features"
      :param pool:
          the pooling method to use
      :return: shape: (batch_size, dim)
          the encoded representations.
      """
      return pool(encoder(images)["feature"])
  
imports: import functools
  import pathlib
  from typing import Any, Callable, Optional, Sequence, Union
  import torch
  import torch.nn
  import torch.utils.data
  from class_resolver import OptionalKwargs
  from docdata import parse_docdata
  from .representation import BackfillRepresentation, Representation
  from .utils import ShapeError, WikidataCache
  from ..datasets import Dataset
  from ..triples import TriplesFactory
  from ..typing import OneOrSequence
label_desc: Use image node_id 2 for calling the VisualRepresentation obj's underlying member method code with example usage: obj._encode(images, encoder, pool) and returns: pool