zoukankan      html  css  js  c++  java
  • 关于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);

     

  • 相关阅读:
    Thinkphp5.0实战开发一------命名空间详解
    软件测试技术实验二
    软件测试技术作业3---PrintPrimes()
    软件测试技术实验一
    Github使用教程(二)------ Github客户端使用方法
    Github使用教程(一)------ 初识Github
    软件测试技术作业2
    软件测试作业1 — 令我印象最深的BUG
    Github网站加载不完全,响应超时,如何解决
    利用puppeteer实现PDF文件导出
  • 原文地址:https://www.cnblogs.com/finallyliuyu/p/7632829.html
Copyright © 2011-2022 走看看