Skip to content

Commit

Permalink
another attempt to fix intermittent test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
irenaby committed Oct 21, 2024
1 parent bba3bd1 commit 8c444b9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def get_expected_shape(t_shape, granularity, node_type, num_scores):

class TestHessianInfoCalculatorBase(unittest.TestCase):

def _setup(self, layer, input_shape=(1, 8, 8, 3)):
def _setup(self, layer, input_shape=(1, 16, 16, 3)):
in_model = basic_model(input_shape, layer=layer)
keras_impl = KerasImplementation()
_repr_dataset = functools.partial(representative_dataset,
Expand Down
6 changes: 3 additions & 3 deletions tests/keras_tests/function_tests/test_hessian_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def multiple_act_nodes_model(input_shape):
def get_representative_dataset_fn(n_iters=10):
def f():
for _ in range(n_iters):
yield [np.random.randn(2, 8, 8, 3).astype(np.float32)]
yield [np.random.randn(2, 16, 16, 3).astype(np.float32)]
return f


Expand All @@ -65,7 +65,7 @@ def tearDown(self) -> None:

def setUp(self):

input_shape = (8, 8, 3)
input_shape = (16, 16, 3)
self.float_model = basic_model(input_shape)
self.keras_impl = KerasImplementation()
self.graph = prepare_graph_with_configs(self.float_model,
Expand Down Expand Up @@ -155,7 +155,7 @@ def test_fetch_required_zero(self):
self.assertEqual(hessian[node.name].shape[0], 0, "Expecting an empty Hessian scores list.")

def test_fetch_multiple_nodes(self):
input_shape = (8, 8, 3)
input_shape = (16, 16, 3)
self.float_model = multiple_act_nodes_model(input_shape)
self.keras_impl = KerasImplementation()
self.graph = prepare_graph_with_configs(self.float_model,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(self):
self.conv2 = Conv2d(3, 3, kernel_size=3, stride=1, padding=1)
self.bn2 = BatchNorm2d(3)
self.relu2 = ReLU()
self.dense = Linear(8, 7)
self.dense = Linear(16, 7)

def forward(self, inp):
x = self.conv1(inp)
Expand All @@ -79,7 +79,7 @@ def __init__(self):
self.bn2 = BatchNorm2d(3)
self.relu2 = ReLU()
self.hswish = Hardswish()
self.dense = Linear(8, 7)
self.dense = Linear(16, 7)

def forward(self, inp):
x = self.conv1(inp)
Expand Down Expand Up @@ -145,7 +145,7 @@ def __init__(self, unit_test, model, n_iters=10):
self.n_iters = n_iters

def create_inputs_shape(self):
return [[self.val_batch_size, 3, 8, 8]]
return [[self.val_batch_size, 3, 16, 16]]

@staticmethod
def generate_inputs(input_shapes):
Expand Down
2 changes: 1 addition & 1 deletion tests/pytorch_tests/function_tests/test_hessian_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def forward(self, x):

def representative_dataset():
for _ in range(2):
yield [np.random.randn(2, 3, 8, 8).astype(np.float32)]
yield [np.random.randn(2, 3, 16, 16).astype(np.float32)]


class BaseHessianServiceTest(BasePytorchTest):
Expand Down

0 comments on commit 8c444b9

Please sign in to comment.