class_docstr: A classical (non-variational) autoencoder that
  does not use reparameterization but instead uses
  an ordinary normalization technique to constrain
  the latent space
  
  Arguments
  ---------
  encoder: torch.nn.Module
      the encoder to be used
  decoder: torch.nn.Module
      the decoder to be used
  norm: torch.nn.Module
      the normalization module
  mask_latent: bool
      where to apply the length mask to the latent representation
  mask_out: bool
      whether to apply the length mask to the output
  out_mask_value: float
      the mask value used for the output
  
  Examples
  --------
  >>> import torch
  >>> from torch import nn
  >>> from speechbrain.nnet.linear import Linear
  >>> ae_enc = Linear(n_neurons=16, input_size=128)
  >>> ae_dec = Linear(n_neurons=128, input_size=16)
  >>> ae = NormalizingAutoencoder(
  ...     encoder=ae_enc,
  ...     decoder=ae_dec,
  ... )
  >>> x = torch.randn(4, 10, 128)
  >>> x_enc = ae.encode(x)
  >>> x_enc.shape
  torch.Size([4, 10, 16])
  >>> x_dec = ae.decode(x_enc)
  >>> x_dec.shape
  torch.Size([4, 10, 128])
docstr: Provides a data sample for training the autoencoder
  
  Arguments
  ---------
  x: torch.Tensor
      the source data (in the sample space)
  length: None
      the length (optional). If provided, latents and
      outputs will be masked
  
  
  Returns
  -------
  result: AutoencoderOutput
      a named tuple with the following values
      rec: torch.Tensor
          the reconstruction
      latent: torch.Tensor
          the latent space sample
docstr_tok: ["Provides","a","data","sample","for","training","the","autoencoder","Arguments","--","--","--","--","-","x",":","torch.Tensor","the","source","data","(","in","the","sample","space",")","length",":","None","the","length","(","optional",")",".","If","provided",",","latents","and","outputs","will","be","masked","Returns","--","--","--","-","result",":","AutoencoderOutput","a","named","tuple","with","the","following","values","rec",":","torch.Tensor","the","reconstruction","latent",":","torch.Tensor","the","latent","space","sample"]
code: def train_sample(
      self, x, length=None, out_mask_value=None, latent_mask_value=None
  ):
      """Provides a data sample for training the autoencoder
  
      Arguments
      ---------
      x: torch.Tensor
          the source data (in the sample space)
      length: None
          the length (optional). If provided, latents and
          outputs will be masked
  
  
      Returns
      -------
      result: AutoencoderOutput
          a named tuple with the following values
          rec: torch.Tensor
              the reconstruction
          latent: torch.Tensor
              the latent space sample
  
      """
      if out_mask_value is None:
          out_mask_value = self.out_mask_value
      if latent_mask_value is None:
          latent_mask_value = self.latent_mask_value
      latent = self.encode(x, length=length)
      if self.latent_padding is not None:
          latent, latent_length = self.latent_padding(
              latent, length=length
          )
      else:
          latent_length = length
      if self.mask_latent and length is not None:
          latent = clean_padding(
              latent, latent_length, self.len_dim, latent_mask_value
          )
      x_rec = self.decode(latent)
      x_rec = trim_as(x_rec, x)
      if self.mask_out and length is not None:
          x_rec = clean_padding(
              x_rec, length, self.len_dim, out_mask_value
          )
  
      return AutoencoderOutput(x_rec, latent, latent_length)
  
imports: import torch
  from torch import nn
  from collections import namedtuple
  from speechbrain.dataio.dataio import clean_padding
  from speechbrain.utils.data_utils import trim_as
  from speechbrain.processing.features import GlobalNorm
label_desc: Use image node_id 4 for calling the NormalizingAutoencoder obj's underlying member method code with example usage: obj.train_sample(x, length, out_mask_value, latent_mask_value) and returns: AutoencoderOutput