code: def rand_perlin_2d_octaves(shape, res, octaves=1, persistence=0.5):
      """Generate Perlin noise parameterized by the octaves method. PyTorch version."""
      noise = torch.zeros(shape)
      frequency = 1
      amplitude = 1
      for _ in range(octaves):
          noise += amplitude * _rand_perlin_2d(
              shape, (frequency * res[0], frequency * res[1])
          )
          frequency *= 2
          amplitude *= persistence
      return noise
  
file_path: anomalib/src/anomalib/data/utils/generators/perlin.py
imports: from __future__ import annotations
  import math
  import numpy
  import torch
  from torch import Tensor
label_desc: Use image node_id 7 for calling a global function with example usage: rand_perlin_2d_octaves(shape, res, octaves, persistence) and returns: noise