概述
先说明函数:
案例:
input=tf.random_normal([2, 3, 3, 5]) #生成四维张量,有关各个张量分量的理解,可参考图像卷积博文http://blog.csdn.net/GoodShot/article/details/79653742 sess=tf.Session() mat=sess.run(input) print("mat:",mat) #生成四维张量 print("mat[0]:n",mat[0]) print("mat[0][0]:n",mat[0][0]) print("mat[0][0][0]:n",mat[0][0][0]) print("mat[0][0][0][0]:n",mat[0][0][0][0])
print("mat:",mat) print("mat[1]:n",mat[1]) print("mat[1][0]:n",mat[1][0]) print("mat[1][0][0]:n",mat[1][0][0]) print("mat[1][0][0][0]:n",mat[1][0][0][0])
第一部分输出:
mat: [[[[ 0.594109 -0.66308975 -0.69155884 -0.51632053 0.25832146]
[0.01957853 0.16430238 -0.80717999-0.19680725 -0.95925415]
[0.6863125 0.6016984 1.01236427 -0.7422542 0.64923733]]
[[-0.62370527 0.68413544 0.04029818 1.12874281 0.57089478]
[-1.74539924 -0.84010768 0.34538889 0.70139134 0.32486886]
[-0.64678913 0.78401089-0.3739692 2.28909111 0.0142019 ]]
[[-0.83594781 0.45074186 0.54473615 0.65086919 -0.43142638]
[-0.84368372 -0.05472387 0.78221375 -0.04815574 -0.64128023]
[0.78006583 -0.22719766 0.09432093-0.19911072 0.10750464]]]
[[[-1.95126927 1.71402228 -0.23699592 -0.33628145 0.53677434]
[ 0.432484 -0.09254493 0.34713465 0.77107131 -0.75730181]
[-1.91144371 0.46466377 -0.72535664 -0.78066158 1.32734716]]
[[ 0.27377656 -0.89142317 -1.2637589 0.82287949 -1.37860918]
[ 0.42658806 0.3984631 -0.98085612 0.40774152 1.08501017]
[-1.93515992 0.8820737 0.95396763 0.96513945 -0.92238081]]
[[-0.38097137 -0.45925513 0.49742085 0.20255992 0.59370619]
[-0.46083522 -1.08463156 -0.43149 -2.83155179 1.65423214]
[ 0.11485368 0.05160266 -0.73833942 -0.55305499 1.91214359]]]]
mat[0]:
[[[0.594109 -0.66308975 -0.69155884-0.51632053 0.25832146]
[0.01957853 0.16430238 -0.80717999-0.19680725 -0.95925415]
[0.6863125 0.6016984 1.01236427 -0.7422542 0.64923733]]
[[-0.62370527 0.68413544 0.04029818 1.12874281 0.57089478]
[-1.74539924 -0.84010768 0.34538889 0.70139134 0.32486886]
[-0.64678913 0.78401089-0.3739692 2.28909111 0.0142019 ]]
[[-0.83594781 0.45074186 0.54473615 0.65086919 -0.43142638]
[-0.84368372 -0.05472387 0.78221375 -0.04815574 -0.64128023]
[0.78006583 -0.22719766 0.09432093-0.19911072 0.10750464]]]
mat[0][0]:
[[0.594109 -0.66308975 -0.69155884-0.51632053 0.25832146]
[0.01957853 0.16430238 -0.80717999-0.19680725 -0.95925415]
[0.6863125 0.6016984 1.01236427 -0.7422542 0.64923733]]
mat[0][0][0]:
[0.594109 -0.66308975 -0.69155884-0.51632053 0.25832146]
mat[0][0][0][0]:
0.594109
第二部分输出:
mat: [[[[ 0.594109 -0.66308975 -0.69155884 -0.51632053 0.25832146]
[0.01957853 0.16430238 -0.80717999-0.19680725 -0.95925415]
[ 0.6863125 0.6016984 1.01236427 -0.7422542 0.64923733]]
[[-0.62370527 0.68413544 0.04029818 1.12874281 0.57089478]
[-1.74539924 -0.84010768 0.34538889 0.70139134 0.32486886]
[-0.64678913 0.78401089-0.3739692 2.28909111 0.0142019 ]]
[[-0.83594781 0.45074186 0.54473615 0.65086919 -0.43142638]
[-0.84368372 -0.05472387 0.78221375 -0.04815574 -0.64128023]
[0.78006583 -0.22719766 0.09432093-0.19911072 0.10750464]]]
[[[-1.95126927 1.71402228 -0.23699592 -0.33628145 0.53677434]
[ 0.432484 -0.09254493 0.34713465 0.77107131 -0.75730181]
[-1.91144371 0.46466377 -0.72535664 -0.78066158 1.32734716]]
[[ 0.27377656 -0.89142317 -1.2637589 0.82287949 -1.37860918]
[ 0.42658806 0.3984631 -0.98085612 0.40774152 1.08501017]
[-1.93515992 0.8820737 0.95396763 0.96513945 -0.92238081]]
[[-0.38097137 -0.45925513 0.49742085 0.20255992 0.59370619]
[-0.46083522 -1.08463156 -0.43149 -2.83155179 1.65423214]
[ 0.11485368 0.05160266 -0.73833942 -0.55305499 1.91214359]]]]
mat[1]:
[[[-1.95126927 1.71402228 -0.23699592 -0.33628145 0.53677434]
[0.432484 -0.09254493 0.34713465 0.77107131 -0.75730181]
[-1.91144371 0.46466377-0.72535664 -0.78066158 1.32734716]]
[[0.27377656 -0.89142317 -1.2637589 0.82287949 -1.37860918]
[0.42658806 0.3984631 -0.98085612 0.40774152 1.08501017]
[-1.93515992 0.8820737 0.95396763 0.96513945 -0.92238081]]
[[-0.38097137 -0.45925513 0.49742085 0.20255992 0.59370619]
[-0.46083522 -1.08463156 -0.43149 -2.83155179 1.65423214]
[0.11485368 0.05160266 -0.73833942-0.55305499 1.91214359]]]
mat[1][0]:
[[-1.95126927 1.71402228 -0.23699592 -0.33628145 0.53677434]
[0.432484 -0.09254493 0.34713465 0.77107131 -0.75730181]
[-1.91144371 0.46466377 -0.72535664 -0.78066158 1.32734716]]
mat[1][0][0]:
[-1.95126927 1.71402228 -0.23699592 -0.33628145 0.53677434]
mat[1][0][0][0]:
-1.95127
最后
以上就是甜蜜香菇为你收集整理的tensorflow中random_normal的使用,案例说明,一看便知的全部内容,希望文章能够帮你解决tensorflow中random_normal的使用,案例说明,一看便知所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复