code: def test_offset_loss(self):
      pred_offset = torch.tensor([[2, 0, 0], [0, 1, 0]]).float()
      gt_offsets = torch.tensor([[2, 0, 0], [0, 1, 0]]).float()
  
      losses = offset_loss(pred_offset, gt_offsets, 2)
      self.assertEqual(losses["offset_norm_loss"].item(), 0)
      self.assertAlmostEqual(
          losses["offset_dir_loss"].item(), -1, places=5
      )
  
      gt_offsets = torch.tensor([[2, 0, 0], [0, -1, 0]]).float()
  
      losses = offset_loss(pred_offset, gt_offsets, 2)
      self.assertAlmostEqual(
          losses["offset_norm_loss"].item(), (0 + 2) / 2.0, places=5
      )
      self.assertAlmostEqual(
          losses["offset_dir_loss"].item(), (-1 + 1) / 2.0, places=5
      )
  
file_path: torch-points3d/test/test_pointgroup.py
imports: import os
  import sys
  import unittest
  import torch
  from torch_points3d.core.losses import offset_loss, instance_iou_loss
label_desc: Use image node_id 1 for calling the TestPointGroupLosses obj's underlying member method code with example usage: obj.test_offset_loss() without return types