code: def get_branges_scales(x, sample_drop_ratio=0.0):
      b, n, d = x.shape
      sample_subset_size = max(int(b * (1 - sample_drop_ratio)), 1)
      brange = (torch.randperm(b, device=x.device))[:sample_subset_size]
      residual_scale_factor = b / sample_subset_size
      return brange, residual_scale_factor
  
imports: import logging
  import os
  from typing import Callable, List, Any, Tuple, Dict
  import warnings
  import torch
  from torch import nn, Tensor
  from .attention import Attention, MemEffAttention
  from .drop_path import DropPath
  from .layer_scale import LayerScale
  from .mlp import Mlp
label_desc: Use image node_id 2 for calling a global function with example usage: get_branges_scales(x, sample_drop_ratio) and returns: brange,  residual_scale_factor