From e6e1c5e78652a58117c386fd233b803cae3762a2 Mon Sep 17 00:00:00 2001 From: Jackwaterveg <87408988+Jackwaterveg@users.noreply.github.com> Date: Mon, 27 Jun 2022 14:05:31 +0800 Subject: [PATCH] [Docs] Fix doc of kaiming initializer (#43823) * Update kaiming.py * Update initializer.py * fix doc bug;test=document_fix * fix doc;test=document_fix * Update initializer.py * Update kaiming.py * for ci;test=document_fix Co-authored-by: Ligoml <39876205+Ligoml@users.noreply.github.com> --- python/paddle/fluid/initializer.py | 10 ++++------ python/paddle/nn/initializer/kaiming.py | 14 +++++--------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/python/paddle/fluid/initializer.py b/python/paddle/fluid/initializer.py index df42516a43e..4ffaedee55e 100644 --- a/python/paddle/fluid/initializer.py +++ b/python/paddle/fluid/initializer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. +# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -686,11 +686,9 @@ class MSRAInitializer(Initializer): \frac{gain}{\sqrt{{fan\_in}}} Args: - uniform (bool): whether to use uniform or normal distribution - fan_in (float32|None): fan_in (in_features) of trainable Tensor,\ - If None, it will be infered automaticly. If you don't want to use in_features of the Tensor,\ - you can set the value of 'fan_in' smartly by yourself. default is None. - seed (int32): random seed + uniform (bool, optional): whether to use uniform or normal distribution + fan_in (float32|None, optional): fan_in (in_features) of trainable Tensor, If None, it will be infered automaticly. If you don't want to use in_features of the Tensor, you can set the value of 'fan_in' smartly by yourself. default is None. + seed (int32, optional): random seed. negative_slope (float, optional): negative_slope (only used with leaky_relu). default is 0.0. nonlinearity(str, optional): the non-linear function. default is relu. diff --git a/python/paddle/nn/initializer/kaiming.py b/python/paddle/nn/initializer/kaiming.py index 8760c15096f..38394eb5b93 100644 --- a/python/paddle/nn/initializer/kaiming.py +++ b/python/paddle/nn/initializer/kaiming.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. +# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -36,9 +36,7 @@ class KaimingNormal(MSRAInitializer): \frac{gain}{\sqrt{{fan\_in}}} Args: - fan_in (float32|None): fan_in (in_features) of trainable Tensor,\ - If None, it will be infered automaticly. If you don't want to use in_features of the Tensor,\ - you can set the value of 'fan_in' smartly by yourself. default is None. + fan_in (float32|None, optional): fan_in (in_features) of trainable Tensor, If None, it will be infered automaticly. If you don't want to use in_features of the Tensor, you can set the value of 'fan_in' smartly by yourself. default is None. negative_slope (float, optional): negative_slope (only used with leaky_relu). default is 0.0. nonlinearity(str, optional): the non-linear function. default is relu. @@ -47,7 +45,7 @@ class KaimingNormal(MSRAInitializer): Examples: .. code-block:: python - :name: code-example1 + import paddle import paddle.nn as nn @@ -84,9 +82,7 @@ class KaimingUniform(MSRAInitializer): x = gain \times \sqrt{\frac{3}{fan\_in}} Args: - fan_in (float32|None): fan_in (in_features) of trainable Tensor,\ - If None, it will be infered automaticly. If you don't want to use in_features of the Tensor,\ - you can set the value of 'fan_in' smartly by yourself. default is None. + fan_in (float32|None, optional): fan_in (in_features) of trainable Tensor, If None, it will be infered automaticly. If you don't want to use in_features of the Tensor, you can set the value of 'fan_in' smartly by yourself. default is None. negative_slope (float, optional): negative_slope (only used with leaky_relu). default is 0.0. nonlinearity(str, optional): the non-linear function. default is relu. @@ -95,7 +91,7 @@ class KaimingUniform(MSRAInitializer): Examples: .. code-block:: python - :name: code-example1 + import paddle import paddle.nn as nn -- GitLab