tf.nn.conv2d实现卷积的过程
#coding=utf-8 import tensorflow as tf
#case 2
input = tf.Variable(tf.round(10 * tf.random_normal([1,3,3,2])))
filter = tf.Variable(tf.round(5 * tf.random_normal([1,1,2,1])))
op2 = tf.nn.conv2d(input, filter, strides=[1, 1, 1, 1], padding='VALID')
#对于filter,多个输入通道,变成一个输入通道,是对各个通道上的卷积值进行相加
init = tf.global_variables_initializer()
with tf.Session() as sess:
sess.run(init)
print("case 2")
print("input: ", sess.run(input))
print("filter: ", sess.run(filter))
print("conv ", sess.run(op2))
# case 2
# input: [[[[-14. -11.]
# [ 2. 2.]
# [ 25. 18.]]
#
# [[ 8. 13.]
# [ -7. -7.]
# [ 11. 6.]]
#
# [[ -1. 8.]
# [ 18. 10.]
# [ -2. 19.]]]]
# filter: [[[[-3.]
# [ 2.]]]] # conv [[[[ 20.]
# [ -2.]
# [-39.]]
#
# [[ 2.]
# [ 7.]
# [-21.]]
#
# [[ 19.]
# [-34.]
# [ 44.]]]]
#转换:输入为3*3的2通道数据
#通道1:
#[-14 2 25],
#[8 -7 11],
#[-1 18 -2]
#通道2:
#[-11 2 18],
#[13 -7 6],
#[8 10 19]
#conv转换
#[20 -2 -39],
#[2 -7 -21],
#[9 -34 44] #计算过程
#[-14 2 25],
#[8 -7 11], * [-3] +
#[-1 18 -2]
#[-11 2 18],
#[13 -7 6], * [2]
#[8 10 19]
#result
#[20 -2 -39],
#[2 -7 -21],
#[9 -34 44]
tf.nn.conv2d实现卷积的过程的更多相关文章
- tf.nn.conv2d。卷积函数
tf.nn.conv2d是TensorFlow里面实现卷积的函数,参考文档对它的介绍并不是很详细,实际上这是搭建卷积神经网络比较核心的一个方法,非常重要 tf.nn.conv2d(input, fil ...
- 深度学习原理与框架-Tensorflow卷积神经网络-卷积神经网络mnist分类 1.tf.nn.conv2d(卷积操作) 2.tf.nn.max_pool(最大池化操作) 3.tf.nn.dropout(执行dropout操作) 4.tf.nn.softmax_cross_entropy_with_logits(交叉熵损失) 5.tf.truncated_normal(两个标准差内的正态分布)
1. tf.nn.conv2d(x, w, strides=[1, 1, 1, 1], padding='SAME') # 对数据进行卷积操作 参数说明:x表示输入数据,w表示卷积核, stride ...
- tf.nn.conv2d卷积函数之图片轮廓提取
一.tensorflow中二维卷积函数的参数含义:def conv2d(input, filter, strides, padding, use_cudnn_on_gpu=True, data_for ...
- tf入门-tf.nn.conv2d是怎样实现卷积的?
转自:https://blog.csdn.net/mao_xiao_feng/article/details/78004522 实验环境:tensorflow版本1.2.0,python2.7 介绍 ...
- 【TensorFlow】tf.nn.conv2d是怎样实现卷积的?
tf.nn.conv2d是TensorFlow里面实现卷积的函数,参考文档对它的介绍并不是很详细,实际上这是搭建卷积神经网络比较核心的一个方法,非常重要 tf.nn.conv2d(input, fil ...
- tf.nn.conv2d 卷积
tf.nn.conv2d(input, filter, strides, padding, use_cudnn_on_gpu=None, name=None) 第一个参数input:指需要做卷积的输入 ...
- 深度学习原理与框架-图像补全(原理与代码) 1.tf.nn.moments(求平均值和标准差) 2.tf.control_dependencies(先执行内部操作) 3.tf.cond(判别执行前或后函数) 4.tf.nn.atrous_conv2d 5.tf.nn.conv2d_transpose(反卷积) 7.tf.train.get_checkpoint_state(判断sess是否存在
1. tf.nn.moments(x, axes=[0, 1, 2]) # 对前三个维度求平均值和标准差,结果为最后一个维度,即对每个feature_map求平均值和标准差 参数说明:x为输入的fe ...
- TensorFlow使用记录 (二): 理解tf.nn.conv2d方法
方法定义 tf.nn.conv2d(input, filter, strides, padding, use_cudnn_on_gpu=True, data_format="NHWC&quo ...
- TF-卷积函数 tf.nn.conv2d 介绍
转自 http://www.cnblogs.com/welhzh/p/6607581.html 下面是这位博主自己的翻译加上测试心得 tf.nn.conv2d是TensorFlow里面实现卷积的函数, ...
随机推荐
- es5 - array - sort
/** * 描述:该sort()方法对数组中的元素进行排序并返回该数组,默认排序顺序是根据字符串Unicode代码点. * 语法:arr .sort([compareFunction]) * 参数: ...
- ng-class
在前面Angularjs开发一些经验总结中我们说到在angular开发中angular controller never 包含DOM元素(html/css),在controller需要一个简单的POJ ...
- Spring 切面优先级
之前我们提过的应用场景,一个原始对象可能会需要插入多个切面,如果我们按前几篇博客文章介绍的方法完成切面及其通知的注解声明,那么它的执行顺序是怎么样的呢? 本文将介绍AspectJ的切面如何划分优先级 ...
- Windows下Hadoop编程环境配置指南
刘勇 Email: lyssym@sina.com 本博客记录作者在工作与研究中所经历的点滴,一方面给自己的工作与生活留下印记,另一方面若是能对大家有所帮助,则幸甚至哉矣! 简介 鉴于最近在研究 ...
- Unity3D游戏开发之SQLite让数据库开发更简单
各位朋友大家好.欢迎大家关注我的博客,我是秦元培,我是博客地址是http://blog.csdn.net/qinyuanpei.在经历了一段时间的忙碌后,博主最终有时间来研究新的东西啦,今天博客向和大 ...
- zoj 2921 Stock(贪心)
Optiver sponsored problem. After years of hard work Optiver has developed a mathematical model that ...
- 使用多字节字符集的跨平台(PC、Android、IOS、WP)编码/解码方法
随着移动端的发展,跨平台已成为通讯架构设计的重要考虑因素,PC.Android.IOS.WP等跨多平台间的数据通讯,必然要解决字符编码/解码的问题. 多字节字符集MBCS不是跨平台的首选字符集,面向跨 ...
- Java SSL证书的安装
https正在成为主流,http估计在不久的将来会被彻底放弃…… 一个Java程序需要访问一个https的网站的时候,可能需要涉及证书的安装,卸载等操作. 一.证书的下载 打开浏览器输入https:/ ...
- C# Debug
语法.IDE环境使用.Debug方法是学习一门语言的最少必须技能,本文总结C#中的最常用调试方法 一. 断点 如下图所示在欲插入断点的地方右键>断点>插入断点(或在行号左边点击)可在选中语 ...
- int main() 与 int _tmain()
用过C的人都知道每一个C的程序都会有一个main(),但有时看别人写的程序发现主函数不是int main(),而是int _tmain(),而且头文件也不是<iostream.h>而是&l ...
