class_docstr: SegResNetVAE based on `3D MRI brain tumor segmentation using autoencoder regularization
  <https://arxiv.org/pdf/1810.11654.pdf>`_.
  The module contains the variational autoencoder (VAE).
  The model supports 2D or 3D inputs.
  
  Args:
      input_image_size: the size of images to input into the network. It is used to
          determine the in_features of the fc layer in VAE.
      vae_estimate_std: whether to estimate the standard deviations in VAE. Defaults to ``False``.
      vae_default_std: if not to estimate the std, use the default value. Defaults to 0.3.
      vae_nz: number of latent variables in VAE. Defaults to 256.
          Where, 128 to represent mean, and 128 to represent std.
      spatial_dims: spatial dimension of the input data. Defaults to 3.
      init_filters: number of output channels for initial convolution layer. Defaults to 8.
      in_channels: number of input channels for the network. Defaults to 1.
      out_channels: number of output channels for the network. Defaults to 2.
      dropout_prob: probability of an element to be zero-ed. Defaults to ``None``.
      act: activation type and arguments. Defaults to ``RELU``.
      norm: feature normalization type and arguments. Defaults to ``GROUP``.
      use_conv_final: if add a final convolution block to output. Defaults to ``True``.
      blocks_down: number of down sample blocks in each layer. Defaults to ``[1,2,2,4]``.
      blocks_up: number of up sample blocks in each layer. Defaults to ``[1,1,1]``.
      upsample_mode: [``"deconv"``, ``"nontrainable"``, ``"pixelshuffle"``]
          The mode of upsampling manipulations.
          Using the ``nontrainable`` modes cannot guarantee the model's reproducibility. Defaults to``nontrainable``.
  
          - ``deconv``, uses transposed convolution layers.
          - ``nontrainable``, uses non-trainable `linear` interpolation.
          - ``pixelshuffle``, uses :py:class:`monai.networks.blocks.SubpixelUpsample`.
docstr: Args:
      net_input: the original input of the network.
      vae_input: the input of VAE module, which is also the output of the network's encoder.
docstr_tok: ["Args",":","net_input",":","the","original","input","of","the","network",".","vae_input",":","the","input","of","VAE","module",",","which","is","also","the","output","of","the","network","'s","encoder","."]
code: def _get_vae_loss(
      self, net_input: torch.Tensor, vae_input: torch.Tensor
  ):
      """
      Args:
          net_input: the original input of the network.
          vae_input: the input of VAE module, which is also the output of the network's encoder.
      """
      x_vae = self.vae_down(vae_input)
      x_vae = x_vae.view(-1, self.vae_fc1.in_features)
      z_mean = self.vae_fc1(x_vae)
  
      z_mean_rand = torch.randn_like(z_mean)
      z_mean_rand.requires_grad_(False)
  
      if self.vae_estimate_std:
          z_sigma = self.vae_fc2(x_vae)
          z_sigma = F.softplus(z_sigma)
          vae_reg_loss = 0.5 * torch.mean(
              z_mean**2
              + z_sigma**2
              - torch.log(1e-8 + z_sigma**2)
              - 1
          )
  
          x_vae = z_mean + z_sigma * z_mean_rand
      else:
          z_sigma = self.vae_default_std
          vae_reg_loss = torch.mean(z_mean**2)
  
          x_vae = z_mean + z_sigma * z_mean_rand
  
      x_vae = self.vae_fc3(x_vae)
      x_vae = self.act_mod(x_vae)
      x_vae = x_vae.view([-1, self.smallest_filters] + self.fc_insize)
      x_vae = self.vae_fc_up_sample(x_vae)
  
      for up, upl in zip(self.up_samples, self.up_layers):
          x_vae = up(x_vae)
          x_vae = upl(x_vae)
  
      x_vae = self.vae_conv_final(x_vae)
      vae_mse_loss = F.mse_loss(net_input, x_vae)
      vae_loss = vae_reg_loss + vae_mse_loss
      return vae_loss
  
imports: from __future__ import annotations
  from collections.abc import Sequence
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from monai.networks.blocks.segresnet_block import ResBlock, get_conv_layer, get_upsample_layer
  from monai.networks.layers.factories import Dropout
  from monai.networks.layers.utils import get_act_layer, get_norm_layer
  from monai.utils import UpsampleMode
label_desc: Use image node_id 3 for calling the SegResNetVAE obj's underlying member method code with example usage: obj._get_vae_loss(net_input, vae_input) and returns: vae_loss