Skip to content

Commit 6b58a0f

Browse files
ndarray
1 parent dc7da3e commit 6b58a0f

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

.github/workflows/weekly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
matrix:
1515
include:
1616
- python_version: "3.9"
17-
override_requirements: "numpy==1.20.0"
17+
override_requirements: "numpy==1.24.0"
1818
- python_version: "3.11"
1919
- python_version: "3.12"
2020
uses: ./.github/workflows/call_precommit.yml

nncf/common/tensor_statistics/collectors.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from typing import Any, Deque, Dict, List, Optional, Tuple, Union, cast
1616

1717
import numpy as np
18+
from numpy.typing import NDArray
1819

1920
from nncf.common.tensor import NNCFTensor
2021
from nncf.common.tensor import TensorType
@@ -317,7 +318,7 @@ class MedianMADStatisticCollector(OfflineTensorStatisticCollector):
317318
Collector estimates median and median absolute deviation (MAD).
318319
"""
319320

320-
def _prepare_statistics(self) -> Tuple[np.ndarray[Any], np.ndarray[Any]]:
321+
def _prepare_statistics(self) -> Tuple[NDArray[Any], NDArray[Any]]:
321322
per_channel_history = get_per_channel_history(
322323
self._samples, cast(List[int], self._reduction_shape), discard_zeros=True
323324
)

nncf/common/tensor_statistics/reduction.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from typing import Any, Deque, List, Tuple
1313

1414
import numpy as np
15+
from numpy.typing import NDArray
1516

1617

1718
def get_channel_count_and_dim_idx(scale_shape: List[int]) -> Tuple[int, int]:
@@ -24,7 +25,7 @@ def get_channel_count_and_dim_idx(scale_shape: List[int]) -> Tuple[int, int]:
2425
return channel_count, channel_dim_idx
2526

2627

27-
def split_into_channels(input_: np.ndarray[Any], scale_shape: List[int]) -> List[np.ndarray[Any]]:
28+
def split_into_channels(input_: NDArray[Any], scale_shape: List[int]) -> List[NDArray[Any]]:
2829
channel_count, channel_dim_idx = get_channel_count_and_dim_idx(scale_shape)
2930
channel_first_tensor = np.moveaxis(input_, channel_dim_idx, 0)
3031
if channel_count == 1:
@@ -60,7 +61,7 @@ def get_per_channel_history(
6061
return per_channel_history
6162

6263

63-
def np_percentile_reduce_like(input_: np.ndarray[Any], ref_tensor_shape: Tuple[int], q: float) -> np.ndarray[Any]:
64+
def np_percentile_reduce_like(input_: NDArray[Any], ref_tensor_shape: Tuple[int], q: float) -> NDArray[Any]:
6465
numel = np.prod(ref_tensor_shape)
6566
if numel == 1:
6667
return np.array([np.percentile(input_, q)])

0 commit comments

Comments
 (0)