code: def align_scale(all_layer_matrices):
      most_attn_h, most_attn_w = find_most_h_w(all_layer_matrices)
      aligned_layer_matrices = []
      for layer_matrix in all_layer_matrices:
          layer_matrix = resize_last_dim_to_most(
              layer_matrix, most_attn_w
          )
          layer_matrix = layer_matrix.permute(0, 2, 1)
          layer_matrix = resize_last_dim_to_most(
              layer_matrix, most_attn_h
          )
          layer_matrix = layer_matrix.permute(0, 2, 1)
          aligned_layer_matrices.append(layer_matrix)
      return aligned_layer_matrices
  
imports: import math
  from functools import partial
  from typing import Tuple, List
  import numpy
  import torch
  from torch import nn
  from torch.nn.init import trunc_normal_
  from einops import rearrange
  from towhee.models.layers.layers_with_relprop import GELU, Linear, Dropout, Conv2d, Conv3d, Softmax, Sigmoid, LayerNorm, Einsum, Add, Clone, MaxPool3d, IndexSelect
label_desc: Use image node_id 3 for calling a global function with example usage: align_scale(all_layer_matrices) and returns: aligned_layer_matrices