code: def get_embeddings_from_tensor_or_dataset(self, inputs, batch_size):
      inputs = self.process_if_list(inputs)
      embeddings = []
      if isinstance(inputs, (torch.Tensor, list)):
          for i in range(0, len(inputs), batch_size):
              embeddings.append(
                  self.get_embeddings(inputs[i : i + batch_size])
              )
      elif isinstance(inputs, torch.utils.data.Dataset):
          dataloader = torch.utils.data.DataLoader(
              inputs, batch_size=batch_size
          )
          for inp, _ in dataloader:
              embeddings.append(self.get_embeddings(inp))
      else:
          raise TypeError(f"Indexing {type(inputs)} is not supported.")
      return torch.cat(embeddings)
  
imports: import numpy
  import torch
  from ..distances import BatchedDistance, CosineSimilarity
  from .None import common_functions
label_desc: Use image node_id 2 for calling the InferenceModel obj's underlying member method code with example usage: obj.get_embeddings_from_tensor_or_dataset(inputs, batch_size) and returns: torch