diff --git a/tests/onnx/quantization/test_classification_models_graph.py b/tests/onnx/quantization/test_classification_models_graph.py index 4b6f5fe65ff..b44eec662c2 100644 --- a/tests/onnx/quantization/test_classification_models_graph.py +++ b/tests/onnx/quantization/test_classification_models_graph.py @@ -63,7 +63,7 @@ REFERENCE_GRAPHS_TEST_ROOT = 'data/reference_graphs/quantization' -class TestDataloader(Dataset): +class TestDataset(Dataset): def __init__(self, input_shape): super().__init__() self.input_shape = input_shape @@ -88,10 +88,10 @@ def test_min_max_quantization_graph(tmp_path, model, path_ref_graph, input_shape original_model = onnx.load(onnx_model_path) - dataloader = TestDataloader(input_shape) + dataset = TestDataset(input_shape) builder = CompressionBuilder() builder.add_algorithm(ONNXMinMaxQuantization(MinMaxQuantizationParameters(number_samples=1))) - quantized_model = builder.apply(original_model, dataloader) + quantized_model = builder.apply(original_model, dataset) nncf_graph = GraphConverter.create_nncf_graph(quantized_model) nx_graph = nncf_graph.get_graph_for_structure_analysis(extended=True) @@ -115,10 +115,10 @@ def test_post_training_quantization_graph(tmp_path, model, path_ref_graph, input original_model = onnx.load(onnx_model_path) - dataloader = TestDataloader(input_shape) + dataset = TestDataset(input_shape) builder = CompressionBuilder() builder.add_algorithm(PostTrainingQuantization(PostTrainingQuantizationParameters(number_samples=1))) - quantized_model = builder.apply(original_model, dataloader) + quantized_model = builder.apply(original_model, dataset) nncf_graph = GraphConverter.create_nncf_graph(quantized_model) nx_graph = nncf_graph.get_graph_for_structure_analysis(extended=True) diff --git a/tests/onnx/quantization/test_detection_models_graph.py b/tests/onnx/quantization/test_detection_models_graph.py index d27e3cc634e..bfdc5839405 100644 --- a/tests/onnx/quantization/test_detection_models_graph.py +++ b/tests/onnx/quantization/test_detection_models_graph.py @@ -21,7 +21,7 @@ from tests.common.helpers import TEST_ROOT from tests.onnx.test_nncf_graph_builder import check_nx_graph -from tests.onnx.quantization.test_classification_models_graph import TestDataloader +from tests.onnx.quantization.test_classification_models_graph import TestDataset from nncf.experimental.post_training.compression_builder import CompressionBuilder from nncf.experimental.onnx.algorithms.quantization.min_max_quantization import ONNXMinMaxQuantization @@ -66,10 +66,10 @@ def test_min_max_quantization_graph(tmp_path, model_name, model_url, path_ref_gr original_model = onnx.load(onnx_model_path) - dataloader = TestDataloader(input_shape) + dataset = TestDataset(input_shape) builder = CompressionBuilder() builder.add_algorithm(ONNXMinMaxQuantization(MinMaxQuantizationParameters(number_samples=1))) - quantized_model = builder.apply(original_model, dataloader) + quantized_model = builder.apply(original_model, dataset) nncf_graph = GraphConverter.create_nncf_graph(quantized_model) nx_graph = nncf_graph.get_graph_for_structure_analysis(extended=True) diff --git a/tests/onnx/test_samplers.py b/tests/onnx/test_samplers.py index 881b3d2bf4f..4b2fd222a1a 100644 --- a/tests/onnx/test_samplers.py +++ b/tests/onnx/test_samplers.py @@ -29,7 +29,7 @@ (100 * np.ones(INPUT_SHAPE), 2)] -class TestDataloader(Dataset): +class TestDataset(Dataset): def __init__(self, samples: List[Tuple[np.ndarray, int]]): super().__init__(shuffle=False) self.samples = samples @@ -43,9 +43,9 @@ def __len__(self): @pytest.mark.parametrize("batch_size", (1, 2, 3)) def test_batch_sampler(batch_size): - dataloader = TestDataloader(DATASET_SAMPLES) - dataloader.batch_size = batch_size - sampler = ONNXBatchSampler(dataloader) + dataset = TestDataset(DATASET_SAMPLES) + dataset.batch_size = batch_size + sampler = ONNXBatchSampler(dataset) for i, sample in enumerate(sampler): ref_sample = [] ref_target = [] @@ -61,9 +61,9 @@ def test_batch_sampler(batch_size): @pytest.mark.parametrize("batch_size", (1, 2, 3)) def test_random_batch_sampler(batch_size): np.random.seed(0) - dataloader = TestDataloader(DATASET_SAMPLES) - dataloader.batch_size = batch_size - sampler = ONNXRandomBatchSampler(dataloader) + dataset = TestDataset(DATASET_SAMPLES) + dataset.batch_size = batch_size + sampler = ONNXRandomBatchSampler(dataset) random_permuated_indices = [0, 2, 1] for i, sample in enumerate(sampler): ref_sample = [] diff --git a/tests/onnx/test_sanity_sample.py b/tests/onnx/test_sanity_sample.py index ed36e43c565..d138fc213d5 100644 --- a/tests/onnx/test_sanity_sample.py +++ b/tests/onnx/test_sanity_sample.py @@ -47,7 +47,7 @@ ] -class TestDataloader(Dataset): +class TestDataset(Dataset): def __init__(self, samples: List[Tuple[np.ndarray, int]]): super().__init__(shuffle=False) self.samples = samples @@ -59,14 +59,14 @@ def __len__(self): return 1 -def mock_dataloader_creator(dataset_path, input_shape, batch_size, shuffle): - return TestDataloader([(np.zeros(input_shape[1:]), 0), ]) +def mock_dataset_creator(dataset_path, input_shape, batch_size, shuffle): + return TestDataset([(np.zeros(input_shape[1:]), 0), ]) @pytest.mark.parametrize(("model, input_shape"), zip(MODELS, INPUT_SHAPES)) @patch('examples.experimental.onnx.onnx_ptq_classification.create_imagenet_torch_dataset', - new=mock_dataloader_creator) + new=mock_dataset_creator) def test_sanity_quantize_sample(tmp_path, model, input_shape): model_name = str(model.__class__) onnx_model_dir = str(TEST_ROOT.joinpath('onnx', 'data', 'models')) diff --git a/tests/onnx/test_statistics_aggregator.py b/tests/onnx/test_statistics_aggregator.py index ea8fbd1c089..65518f3c62d 100644 --- a/tests/onnx/test_statistics_aggregator.py +++ b/tests/onnx/test_statistics_aggregator.py @@ -22,7 +22,7 @@ from nncf.experimental.post_training.algorithms.quantization.min_max_quantization import RangeType from tests.onnx.models import OneConvolutionalModel -from tests.onnx.test_samplers import TestDataloader +from tests.onnx.test_samplers import TestDataset INPUT_SHAPE = [3, 10, 10] @@ -59,7 +59,7 @@ def __init__(self, number_samples, activation_float_range, weight_float_range): def test_statistics_aggregator(range_type, test_parameters): model = OneConvolutionalModel().onnx_model - dataloader = TestDataloader(DATASET_SAMPLES) + dataset = TestDataset(DATASET_SAMPLES) compression_builder = CompressionBuilder() quantization = ONNXMinMaxQuantization(MinMaxQuantizationParameters( @@ -68,7 +68,7 @@ def test_statistics_aggregator(range_type, test_parameters): )) compression_builder.add_algorithm(quantization) - quantized_model = compression_builder.apply(model, dataloader) + quantized_model = compression_builder.apply(model, dataset) onnx_graph = ONNXGraph(quantized_model) num_q = 0