code: def log_to_duration(log_dur, min_dur, max_dur, mask):
      dur = torch.clamp(torch.exp(log_dur) - 1.0, min_dur, max_dur)
      dur *= mask.squeeze(2)
      return dur
  
imports: import torch
  from nemo.collections.tts.modules.submodules import ConditionalInput, ConditionalLayerNorm
  from nemo.collections.tts.parts.utils.helpers import binarize_attention_parallel, regulate_len
  from nemo.core.classes import NeuralModule, adapter_mixins, typecheck
  from nemo.core.neural_types.elements import EncodedRepresentation, Index, LengthsType, LogprobsType, MelSpectrogramType, ProbsType, RegressionValuesType, TokenDurationType, TokenIndex, TokenLogDurationType
  from nemo.core.neural_types.neural_type import NeuralType
label_desc: Use image node_id 2 for calling a global function with example usage: log_to_duration(log_dur, min_dur, max_dur, mask) and returns: dur