tf.keras.initializers.TruncatedNormal(
mean=0.0, stddev=0.05, seed=None, dtype=tf.dtypes.float32
)
For more information, see tf.keras.initializers.TruncatedNormal.
mindspore.common.initializer.TruncatedNormal(sigma=0.01)
For more information, see mindspore.common.initializer.TruncatedNormal.
TensorFlow: By default, based on a normal distribution with mean 0.0 and standard deviation 0.05, limit the variables to be within 2 times the standard deviation from the mean and regenerate the distribution. Default values: mean=0.0, stddev=0.05.
MindSpore: By default, based on a normal distribution with mean 0.0 and standard deviation 0.01, limit the variables to be within 2 times the standard deviation from the mean and regenerate the distribution. Default values: sigma=0.01.
The following results are random.
import tensorflow as tf
init = tf.keras.initializers.TruncatedNormal()
x = init(shape=(1, 2))
with tf.Session() as sess:
print(x.eval())
# out:
# [[-0.71518797 -0.6879003 ]]
import mindspore as ms
from mindspore.common.initializer import TruncatedNormal, initializer
x = initializer(TruncatedNormal(), shape=[1, 2], dtype=ms.float32)
print(x)
# out:
# [[0.01012452 0.00313655]]
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。