code: def test_expand(self):
      device = "cpu"
      p = ParamData(
          "test", device=device, shape=(2, 3), init_function=torch.ones
      )
      with self.assertRaises(AssertionError):
          p.expand((3, 4))
      with self.assertRaises(AssertionError):
          p.expand((1, 4))
      with self.assertRaises(AssertionError):
          p.expand((1, 4, 5))
      new_p = p.expand((2, 3))
      self.assertTrue(new_p.shape == (2, 3))
      new_p = p.expand((2, 5))
      self.assertTrue((p.data[:2, :3] == 1).all())
      self.assertTrue((p.data[2:, 3:] == 0).all())
      self.assertTrue(new_p.shape == (2, 5))
      self.assertTrue(p.data.shape == (2, 5))
      self.assertTrue(p.shape == (2, 5))
      p = ParamData(
          "test", device=device, shape=(2, 3), init_function=torch.ones
      )
      new_p = p.expand((5, 3))
      self.assertTrue((p.data[:2, :3] == 1).all())
      self.assertTrue((p.data[2:, 3:] == 0).all())
      self.assertTrue(new_p.shape == (5, 3))
      self.assertTrue(p.data.shape == (5, 3))
      self.assertTrue(p.shape == (5, 3))
      p = ParamData("test", device=device, shape=(2, 3))
      p.expand((2, 5), padding_fn=torch.ones)
      self.assertTrue((p.data[:2, :3] == 0).all())
      self.assertTrue((p.data[2:, 3:] == 1).all())
  
file_path: avalanche/tests/training/test_training_utils.py
imports: import unittest
  import torch
  from avalanche.training.utils import ParamData
label_desc: Use image node_id 2 for calling the TestParamData obj's underlying member method code with example usage: obj.test_expand() without return types