关于tensorflow conv2d卷积备忘的一点理解
Posted 学院派的驴
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了关于tensorflow conv2d卷积备忘的一点理解相关的知识,希望对你有一定的参考价值。
**************input**************
[[[[-0.36166722 0.04847232 1.20818889 -0.1794038 -0.53244466]
[-0.67821187 -1.81838071 0.59005165 -1.17246294 0.33203208]
[-0.18631086 -0.68608224 0.07464688 0.28875718 -0.86492658]]
[[ 1.63322294 0.99059737 0.5923292 -0.80913633 -2.2539773 ]
[ 0.14436921 -0.45454684 -0.61321616 -1.01231539 1.54901564]
[ 0.38690856 1.84936357 0.55067211 0.3163861 -0.62082398]]
[[ 0.3655189 1.96013069 0.91159737 1.89106071 2.04635859]
[-1.13240027 -1.64421642 -1.23379624 -0.18057458 -0.37131071]
[-0.55824232 0.5738467 -1.02291656 0.8829596 -2.15986562]]]]
(1, 3, 3, 5)
*****************filter*************
[[[[ 0.43657559 1.01129627]
[ 0.30303505 1.57386982]
[ 0.63144618 -0.38221657]
[ 1.03055692 0.27556673]
[ 0.14717487 -0.47002205]]]]
(1, 1, 5, 2)
***************result************
[[[[ 0.35645172 -0.55043042]
[-1.63396096 -4.25244951]
[-0.07182495 -0.81064451]]
[[ 0.22164512 3.82079363]
[-1.27720094 -1.34204817]
[ 1.31174088 3.47044706]]
[[ 3.57920766 2.66549063]
[-2.0124495 -3.1366334 ]
[-0.12367389 1.98808599]]]]
(1, 3, 3, 2)
import tensorflow as tf
input = tf.Variable(tf.random_normal([1,3,3,5]));
filter = tf.Variable(tf.random_normal([1,1,5,2]));
op = tf.nn.conv2d(input,filter,strides=[1,1,1,1],padding=‘VALID‘);
with tf.Session() as sess:
sess.run(tf.initialize_all_variables());
result=sess.run(op);
print(‘**************input**************‘);
print(sess.run(input));
print(input.shape);
print(‘*****************filter*************‘);
print(sess.run(filter));
print(filter.shape);
print(‘***************result************‘);
print(result);
print(result.shape);
以上是关于关于tensorflow conv2d卷积备忘的一点理解的主要内容,如果未能解决你的问题,请参考以下文章
TensorflowMac上Tensorflow卷积与反卷积