code: def normalize_by_previous_day(packs: torch.Tensor):
      mean_price = (
          packs[:, :, 0 : CandleIdx.open_close]
          .mean(dim=-1)
          .mean(dim=-1)
      )
      mean_volume = packs[:, :, CandleIdx.volume].mean(dim=-1)
      mean_price = mean_price.clamp_min(1e-6)
      mean_volume = mean_volume.clamp_min(1e-6)
  
      data = packs[1:, :, :] / mean_price[:-1].view(-1, 1, 1)
      data[:, :, CandleIdx.volume] = packs[
          1:, :, CandleIdx.volume
      ] / mean_volume[:-1].view(-1, 1)
  
      return data.transpose_(0, 1)
  
file_path: labml/samples/stocks/dataset.py
imports: import numpy
  import torch
  from labml import monit, lab
  from labml import tracker
  from torch.utils.data import Dataset
  from stocks import CandleIdx
  from stocks.build_numpy_cache import build_cache
label_desc: Use image node_id 1 for calling a global function with example usage: normalize_by_previous_day(packs) and returns: data