code: def adjust_f0(f0, f0_mean, f0_std, vmask_bool, musical_scaling=True):
      if f0_mean > 0.0:
          if musical_scaling:
              f0_mu, f0_sigma = (
                  f0[vmask_bool].mean(),
                  f0[vmask_bool].std(),
              )
              f0_factor = f0_mean / f0_mu
              f0[vmask_bool] *= f0_factor
          else:
              f0_sigma, f0_mu = torch.std_mean(f0[vmask_bool])
              f0 = ((f0 - f0_mu) / f0_sigma).to(dtype=f0.dtype)
              f0_std = f0_std if f0_std > 0 else f0_sigma
              f0 = (f0 * f0_std + f0_mean).to(dtype=f0.dtype)
              f0 = f0.masked_fill(~vmask_bool, 0.0)
      return f0
  
imports: import torch
  import torch.nn.functional
  from torch import nn
  from nemo.collections.tts.modules.attribute_prediction_model import get_attribute_prediction_model
  from nemo.collections.tts.modules.common import AffineTransformationLayer, BiLSTM, ConvAttention, ExponentialClass, Invertible1x1Conv, Invertible1x1ConvLUS, LinearNorm, get_radtts_encoder
  from nemo.collections.tts.parts.utils.helpers import get_mask_from_lengths, mas_width1, regulate_len
  from nemo.core.classes import Exportable, NeuralModule
  from nemo.core.neural_types.elements import Index, LengthsType, MelSpectrogramType, TokenDurationType, TokenIndex
  from nemo.core.neural_types.neural_type import NeuralType
label_desc: Use image node_id 3 for calling a global function with example usage: adjust_f0(f0, f0_mean, f0_std, vmask_bool, musical_scaling) and returns: f0