MCPcopy
hub / github.com/meta-pytorch/opacus / setUp

Method setUp

opacus/tests/grad_sample_hooks_test.py:59–69  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

57 CLS = GradSampleHooks
58
59 def setUp(self):
60 self.original_model = SampleConvNet()
61 self.hooks_model = SampleConvNet()
62 self.hooks_model.load_state_dict(self.original_model.state_dict(), strict=True)
63
64 self.grad_sample_hooks = self.CLS(
65 self.hooks_model, batch_first=True, loss_reduction="mean"
66 )
67 self.DATA_SIZE = 8
68 self.setUp_data()
69 self.criterion = nn.L1Loss()
70
71 def setUp_data(self):
72 self.ds = FakeData(

Callers

nothing calls this directly

Calls 4

setUp_dataMethod · 0.95
SampleConvNetClass · 0.70
load_state_dictMethod · 0.45
state_dictMethod · 0.45

Tested by

no test coverage detected