Skip to content

Commit f6ad654

Browse files
authored
[Typing][B-07] Add type annotations for python/paddle/distribution/chi2.py (#65766)
1 parent 4724f5f commit f6ad654

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

python/paddle/distribution/chi2.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,20 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
15+
from __future__ import annotations
16+
17+
from typing import TYPE_CHECKING
18+
1419
import paddle
1520
from paddle.base.data_feeder import check_type, convert_dtype
1621
from paddle.base.framework import Variable
1722
from paddle.distribution.gamma import Gamma
1823
from paddle.framework import in_dynamic_mode
1924

25+
if TYPE_CHECKING:
26+
from paddle import Tensor, dtype
27+
2028
__all__ = ["Chi2"]
2129

2230

@@ -39,7 +47,11 @@ class Chi2(Gamma):
3947
4048
"""
4149

42-
def __init__(self, df):
50+
df: Tensor
51+
rate: Tensor
52+
dtype: dtype
53+
54+
def __init__(self, df: float | Tensor) -> None:
4355
if not in_dynamic_mode():
4456
check_type(
4557
df,

0 commit comments

Comments
 (0)