From ebae6c086eaf0ff199436d1f945785f98fadb8af Mon Sep 17 00:00:00 2001 From: Yilei Yang Date: Fri, 9 Sep 2022 12:19:14 -0700 Subject: [PATCH] Make this code compatible with Python 3.10. PiperOrigin-RevId: 473313795 --- .../membership_inference_attack/dataset_slicing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/dataset_slicing.py b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/dataset_slicing.py index 70747cf..5d4f381 100644 --- a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/dataset_slicing.py +++ b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/dataset_slicing.py @@ -13,7 +13,7 @@ # limitations under the License. """Specifying and creating AttackInputData slices.""" -import collections +from collections import abc import copy import logging from typing import List, Optional @@ -143,7 +143,7 @@ def get_single_slice_specs( result.append(SingleSliceSpec(SlicingFeature.CLASS, c)) elif isinstance(by_class, int): result.append(SingleSliceSpec(SlicingFeature.CLASS, by_class)) - elif isinstance(by_class, collections.Iterable): + elif isinstance(by_class, abc.Iterable): for c in by_class: result.append(SingleSliceSpec(SlicingFeature.CLASS, c))