class_docstr: Helper class to merge volume segmentations on CPU/GPU.
class_docstr_tok: ["Helper","class","to","merge","volume","segmentations","on","CPU\/GPU","."]
docstr: :param volume_shape: Shape of the source image
  :param weight: Weighting matrix
docstr_tok: [":","param","volume_shape",":","Shape","of","the","source","image",":","param","weight",":","Weighting","matrix"]
code: def __init__(
      self,
      volume_shape,
      channels: int,
      weight,
      device="cpu",
      dtype=torch.float32,
  ):
      """
  
      :param volume_shape: Shape of the source image
      :param weight: Weighting matrix
      """
      self.channels = channels
  
      self.weight = torch.from_numpy(np.expand_dims(weight, axis=0)).to(
          device=device, dtype=dtype
      )
      self.volume = torch.zeros(
          (channels, *volume_shape), device=device, dtype=dtype
      )
      self.norm_mask = torch.zeros(
          (1, *volume_shape), device=device, dtype=dtype
      )
  
file_path: pytorch-toolbelt/pytorch_toolbelt/inference/tiles_3d.py
imports: from typing import Union, Tuple, List, Iterable, Any
  import numpy
  import torch
  from pytorch_toolbelt.inference import compute_pyramid_patch_weight_loss
label_desc: Use image node_id 1 to create a new VolumeMerger object  with example: obj = VolumeMerger(volume_shape, channels, weight, device, dtype)