|
| 1 | +# Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | +from __future__ import annotations |
| 15 | + |
| 16 | +from typing import List, Tuple, Union |
| 17 | + |
| 18 | +from typing_extensions import TypeAlias |
| 19 | + |
| 20 | +from .. import Tensor |
| 21 | + |
| 22 | +DynamicShapeLike: TypeAlias = Union[ |
| 23 | + Tuple[Union[int, Tensor, None], ...], |
| 24 | + List[Union[int, Tensor, None]], |
| 25 | + Tensor, |
| 26 | +] |
| 27 | + |
| 28 | + |
| 29 | +ShapeLike: TypeAlias = Union[ |
| 30 | + Tuple[int, ...], |
| 31 | + List[int], |
| 32 | + Tensor, |
| 33 | +] |
| 34 | + |
| 35 | + |
| 36 | +# for size parameters, eg, kernel_size, stride ... |
| 37 | +Size1: TypeAlias = Union[int, Tuple[int], List[int]] |
| 38 | +Size2: TypeAlias = Union[int, Tuple[int, int], List[int]] |
| 39 | +Size3: TypeAlias = Union[int, Tuple[int, int, int], List[int]] |
| 40 | +Size4: TypeAlias = Union[int, Tuple[int, int, int, int], List[int]] |
| 41 | +Size5: TypeAlias = Union[int, Tuple[int, int, int, int, int], List[int]] |
| 42 | +Size6: TypeAlias = Union[int, Tuple[int, int, int, int, int, int], List[int]] |
| 43 | +SizeN: TypeAlias = Union[int, Tuple[int, ...], List[int]] |
0 commit comments