class_docstr: Patchcore Module.
class_docstr_tok: ["Patchcore","Module","."]
docstr: Reshape Embedding.
  
  Reshapes Embedding to the following format:
  [Batch, Embedding, Patch, Patch] to [Batch*Patch*Patch, Embedding]
  
  Args:
      embedding (Tensor): Embedding tensor extracted from CNN features.
  
  Returns:
      Tensor: Reshaped embedding tensor.
docstr_tok: ["Reshape","Embedding",".","Reshapes","Embedding","to","the","following","format",":","[","Batch",",","Embedding",",","Patch",",","Patch","]","to","[","Batch","*","Patch","*","Patch",",","Embedding","]","Args",":","embedding","(","Tensor",")",":","Embedding","tensor","extracted","from","CNN","features",".","Returns",":","Tensor",":","Reshaped","embedding","tensor","."]
code: def reshape_embedding(embedding: Tensor) -> Tensor:
      """Reshape Embedding.
  
      Reshapes Embedding to the following format:
      [Batch, Embedding, Patch, Patch] to [Batch*Patch*Patch, Embedding]
  
      Args:
          embedding (Tensor): Embedding tensor extracted from CNN features.
  
      Returns:
          Tensor: Reshaped embedding tensor.
      """
      embedding_size = embedding.size(1)
      embedding = embedding.permute(0, 2, 3, 1).reshape(
          -1, embedding_size
      )
      return embedding
  
file_path: anomalib/src/anomalib/models/patchcore/torch_model.py
imports: from __future__ import annotations
  import torch
  import torch.nn.functional
  from torch import Tensor, nn
  from anomalib.models.components import DynamicBufferModule, FeatureExtractor, KCenterGreedy
  from anomalib.models.patchcore.anomaly_map import AnomalyMapGenerator
  from anomalib.pre_processing import Tiler
label_desc: Use image node_id 4 for calling the PatchcoreModel obj's underlying member method code with example usage: obj.reshape_embedding(embedding) and returns: embedding