def METHOD_NAME(self, depth, frame='w'):
    """
    Reconstructs pixel-wise 3D points from a depth map.
    Parameters
    ----------
    depth : torch.Tensor [B,1,H,W]
        Depth map for the camera
    frame : 'w'
        Reference frame: 'c' for camera and 'w' for world
    Returns
    -------
    points : torch.tensor [B,3,H,W]
        Pixel-wise 3D points
    """
    B, C, H, W = depth.shape
    assert C == 1
    # Create flat index grid
    grid = image_grid(
        B, H, W, depth.dtype, depth.device, normalized=False)  # [B,3,H,W]
    flat_grid = grid.view(B, 3, -1)  # [B,3,HW]
    # Estimate the outward rays in the camera frame
    xnorm = (self.Kinv.bmm(flat_grid)).view(B, 3, H, W)
    # Scale rays to metric depth
    Xc = xnorm * depth
    # If in camera frame of reference
    if frame == 'c':
        return Xc
    # If in world frame of reference
    elif frame == 'w':
        return self.Twc @ Xc
    # If none of the above
    else:
        raise ValueError('Unknown reference frame {}'.format(frame))