- tf.truncated_normal
问题:矩阵e和f相乘的原理 - tf.constant
- tf.placeholder
要想sess.run掉y,就必须把y需要的x给指定指,所以在sess.run运行里面必须要feed_dict{x:rand_array}
random_array已经是10行10列了,看来x = tf.placeholder(tf.float32,[None,10])处的10是限定列必须是10,其它1呀5呀都不行 - tf.nn.bias_add
几乎没区别 - tf.reduce_mean
- tf.squered_difference
问题:差平方是什么意思? - tf.square
- tf.Variable
实验结果
ubuntu@VM-101-148-ubuntu:~$ python /home/ubuntu/Variable.py
##################(1)################
[[ -9.49649215e-01 7.33523071e-01 -1.25046813e+00 -1.54078627e+00
4.32036258e-03 1.48700178e-01 1.03504753e+00 2.84711808e-01
-6.67270601e-01 4.34477866e-01]
[ -2.90037375e-02 -3.22217882e-01 4.66206491e-01 -1.13211691e+00
-1.46528459e+00 1.59520996e+00 -3.05193067e-01 1.46953309e+00
-7.08630323e-01 1.46954134e-02]
[ 8.71113718e-01 -4.50307041e-01 7.23313153e-01 -2.37906069e-01
-1.32656991e+00 6.67731881e-01 4.88423705e-01 -5.94586432e-01
3.98967534e-01 -3.88914615e-01]
[ 6.22606814e-01 -4.77424979e-01 6.77944481e-01 -9.87960517e-01
-1.87303138e+00 6.91178739e-01 -1.43408728e+00 2.33425096e-01
1.20628035e+00 9.23534334e-02]
[ -6.26788080e-01 6.38400912e-01 9.23972368e-01 3.78043741e-01
-1.40920684e-01 5.34964085e-01 -5.67575932e-01 6.57726050e-05
-2.52135217e-01 -6.14742458e-01]
[ 1.83408928e+00 2.66864568e-01 -1.07115245e+00 4.92292374e-01
1.33048713e+00 9.77971733e-01 -1.48075178e-01 -5.69386423e-01
-1.31655192e+00 -1.55112579e-01]
[ 1.41918913e-01 -1.15312472e-01 1.00739920e+00 2.29228199e-01
3.30840528e-01 -1.96133211e-01 -1.54831612e+00 -2.71399319e-01
-7.76063085e-01 6.36928454e-02]
[ -1.57377613e+00 -7.94189692e-01 -7.72081375e-01 4.64299560e-01
1.43377590e+00 5.81002712e-01 7.69988447e-02 1.05809534e+00
3.25448006e-01 -7.17085302e-01]
[ 9.61096771e-03 1.81182873e+00 7.48413384e-01 1.47499919e+00
4.55330461e-01 7.13815510e-01 -3.08962256e-01 -1.73671111e-01
-1.75019765e+00 1.26547933e-01]
[ -1.60473537e+00 -1.84010589e+00 2.67085016e-01 5.55560410e-01
-1.69008732e-01 -4.71142530e-01 1.22920072e+00 -4.17250574e-01
-1.43117765e-02 1.58844888e+00]]
##################(2)################
[[-0.94964921 0.73352307]
[-0.02900374 -0.32221788]]
###################(3)###############
[[ 2.20000000e+01 2.20000000e+01 -1.25046813e+00 -1.54078627e+00
4.32036258e-03 1.48700178e-01 1.03504753e+00 2.84711808e-01
-6.67270601e-01 4.34477866e-01]
[ 2.20000000e+01 2.20000000e+01 4.66206491e-01 -1.13211691e+00
-1.46528459e+00 1.59520996e+00 -3.05193067e-01 1.46953309e+00
-7.08630323e-01 1.46954134e-02]
[ 8.71113718e-01 -4.50307041e-01 7.23313153e-01 -2.37906069e-01
-1.32656991e+00 6.67731881e-01 4.88423705e-01 -5.94586432e-01
3.98967534e-01 -3.88914615e-01]
[ 6.22606814e-01 -4.77424979e-01 6.77944481e-01 -9.87960517e-01
-1.87303138e+00 6.91178739e-01 -1.43408728e+00 2.33425096e-01
1.20628035e+00 9.23534334e-02]
[ -6.26788080e-01 6.38400912e-01 9.23972368e-01 3.78043741e-01
-1.40920684e-01 5.34964085e-01 -5.67575932e-01 6.57726050e-05
-2.52135217e-01 -6.14742458e-01]
[ 1.83408928e+00 2.66864568e-01 -1.07115245e+00 4.92292374e-01
1.33048713e+00 9.77971733e-01 -1.48075178e-01 -5.69386423e-01
-1.31655192e+00 -1.55112579e-01]
[ 1.41918913e-01 -1.15312472e-01 1.00739920e+00 2.29228199e-01
3.30840528e-01 -1.96133211e-01 -1.54831612e+00 -2.71399319e-01
-7.76063085e-01 6.36928454e-02]
[ -1.57377613e+00 -7.94189692e-01 -7.72081375e-01 4.64299560e-01
1.43377590e+00 5.81002712e-01 7.69988447e-02 1.05809534e+00
3.25448006e-01 -7.17085302e-01]
[ 9.61096771e-03 1.81182873e+00 7.48413384e-01 1.47499919e+00
4.55330461e-01 7.13815510e-01 -3.08962256e-01 -1.73671111e-01
-1.75019765e+00 1.26547933e-01]
[ -1.60473537e+00 -1.84010589e+00 2.67085016e-01 5.55560410e-01
-1.69008732e-01 -4.71142530e-01 1.22920072e+00 -4.17250574e-01
-1.43117765e-02 1.58844888e+00]]
###################(4)###############
[[ 2.20000000e+01 2.20000000e+01 -1.25046813e+00 -1.54078627e+00
4.32036258e-03 1.48700178e-01 1.03504753e+00 2.84711808e-01
-6.67270601e-01 4.34477866e-01]
[ 2.20000000e+01 2.20000000e+01 4.66206491e-01 -1.13211691e+00
-1.46528459e+00 1.59520996e+00 -3.05193067e-01 1.46953309e+00
-7.08630323e-01 1.46954134e-02]
[ 8.71113718e-01 -4.50307041e-01 7.23313153e-01 -2.37906069e-01
-1.32656991e+00 6.67731881e-01 4.88423705e-01 -5.94586432e-01
3.98967534e-01 -3.88914615e-01]
[ 6.22606814e-01 -4.77424979e-01 6.77944481e-01 -9.87960517e-01
-1.87303138e+00 6.91178739e-01 -1.43408728e+00 2.33425096e-01
1.20628035e+00 9.23534334e-02]
[ -6.26788080e-01 6.38400912e-01 9.23972368e-01 3.78043741e-01
-1.40920684e-01 5.34964085e-01 -5.67575932e-01 6.57726050e-05
-2.52135217e-01 -6.14742458e-01]
[ 1.83408928e+00 2.66864568e-01 -1.07115245e+00 4.92292374e-01
1.33048713e+00 9.77971733e-01 -1.48075178e-01 -5.69386423e-01
-1.31655192e+00 -1.55112579e-01]
[ 1.41918913e-01 -1.15312472e-01 1.00739920e+00 2.29228199e-01
3.30840528e-01 -1.96133211e-01 -1.54831612e+00 -2.71399319e-01
-7.76063085e-01 6.36928454e-02]
[ -1.57377613e+00 -7.94189692e-01 -7.72081375e-01 4.64299560e-01
1.43377590e+00 5.81002712e-01 7.69988447e-02 1.05809534e+00
3.25448006e-01 -7.17085302e-01]
[ 9.61096771e-03 1.81182873e+00 7.48413384e-01 1.47499919e+00
4.55330461e-01 7.13815510e-01 -3.08962256e-01 -1.73671111e-01
-1.75019765e+00 1.26547933e-01]
[ -1.60473537e+00 -1.84010589e+00 2.67085016e-01 5.55560410e-01
-1.69008732e-01 -4.71142530e-01 1.22920072e+00 -4.17250574e-01
-1.43117765e-02 1.58844888e+00]]
####################(5)##############
[[ 2.20000000e+01 2.20000000e+01 -1.25046813e+00 -1.54078627e+00
4.32036258e-03 1.48700178e-01 1.03504753e+00 2.84711808e-01
-6.67270601e-01 4.34477866e-01]
[ 2.20000000e+01 2.20000000e+01 4.66206491e-01 -1.13211691e+00
-1.46528459e+00 1.59520996e+00 -3.05193067e-01 1.46953309e+00
-7.08630323e-01 1.46954134e-02]
[ 8.71113718e-01 -4.50307041e-01 7.23313153e-01 -2.37906069e-01
-1.32656991e+00 6.67731881e-01 4.88423705e-01 -5.94586432e-01
3.98967534e-01 -3.88914615e-01]
[ 6.22606814e-01 -4.77424979e-01 6.77944481e-01 -9.87960517e-01
-1.87303138e+00 6.91178739e-01 -1.43408728e+00 2.33425096e-01
1.20628035e+00 9.23534334e-02]
[ -6.26788080e-01 6.38400912e-01 9.23972368e-01 3.78043741e-01
-1.40920684e-01 5.34964085e-01 -5.67575932e-01 6.57726050e-05
-2.52135217e-01 -6.14742458e-01]
[ 1.83408928e+00 2.66864568e-01 -1.07115245e+00 4.92292374e-01
1.33048713e+00 9.77971733e-01 -1.48075178e-01 -5.69386423e-01
-1.31655192e+00 -1.55112579e-01]
[ 1.41918913e-01 -1.15312472e-01 1.00739920e+00 2.29228199e-01
3.30840528e-01 -1.96133211e-01 -1.54831612e+00 -2.71399319e-01
-7.76063085e-01 6.36928454e-02]
[ -1.57377613e+00 -7.94189692e-01 -7.72081375e-01 4.64299560e-01
1.43377590e+00 5.81002712e-01 7.69988447e-02 1.05809534e+00
3.25448006e-01 -7.17085302e-01]
[ 9.61096771e-03 1.81182873e+00 7.48413384e-01 1.47499919e+00
4.55330461e-01 7.13815510e-01 -3.08962256e-01 -1.73671111e-01
-1.75019765e+00 1.26547933e-01]
[ -1.60473537e+00 -1.84010589e+00 2.67085016e-01 5.55560410e-01
-1.69008732e-01 -4.71142530e-01 1.22920072e+00 -4.17250574e-01
-1.43117765e-02 1.58844888e+00]]
#####################(6)#############
<dtype: 'float32_ref'>
[[-1.65740621 -1.19643104 0.26082695 0.60153055 0.54706573 -0.64438766
0.77429032 1.55657506 -0.28962848 -0.19775115]
[-0.25237826 1.39059353 1.1610564 -0.47471896 0.65019715 0.5108102
-1.3384397 0.15497948 -1.10810685 -0.92034507]
[ 0.13410681 1.03378081 -1.73647118 1.745929 -0.46730819 0.7336629
1.4179188 -0.07942269 0.46972397 0.57390577]
[ 0.31234622 0.74865478 -0.12378393 -1.4363451 0.23784967 -0.00491129
-1.22467673 1.48504782 -0.16500494 -1.48376513]
[ 0.98687422 1.09481728 0.79658836 0.74094146 -0.55909723 -1.83261609
0.11568465 1.69092441 0.20706582 1.00933933]
[ 1.13011456 -1.27048314 0.53967553 1.21230352 0.06143386 1.91654146
-1.49307394 0.9991594 1.05475914 -0.45471257]
[ 0.76873338 0.62297827 0.20345998 -0.69973332 -0.36613715 0.17007448
-1.16118622 -0.9316268 -0.51230109 1.62609553]
[ 0.0816388 0.48487979 -1.51914465 -0.4013384 1.70636177 -0.69483781
-0.08444885 0.36662242 -1.11761773 -0.14985012]
[-0.73514146 -0.30243903 -1.15401554 -0.40375915 1.30672967 0.14500667
-0.04466274 1.0781498 0.18931717 1.60773826]
[ 0.07090747 -0.62375903 1.6725024 -0.01919881 -0.84415787 1.66880977
-0.13836439 1.75684702 -0.36099052 -0.48835525]]
None
(10, 10)
###################(7)###############
[[ 1. 1.]
[ 2. 2.]]
ubuntu@VM-101-148-ubuntu:~$
问题:op = W[:2,:2].assign(22.*tf.ones((2,2)))是什么意思?
问题:W.eval(sess))的用法是在计算什么
以上实验基于腾讯实验室提供的环境学习到的
腾讯云实验室