tensorflow版本1.4
获取变量维度是一个使用频繁的操作,在tensorflow中获取变量维度主要用到的操作有以下三种:
Tensor.shape
Tensor.get_shape()
tf.shape(input,name=None,out_type=tf.int32)
对上面三种操作做一下简单分析:(这三种操作先记作A、B、C)
A 和 B 基本一样,只不过前者是Tensor的属性变量,后者是Tensor的函数。
A 和 B 均返回TensorShape类型,而 C 返回
**
一 tf.concat( ) 函数–合并
**
In [2]: a = tf.ones([4,35,8])
In [3]: b = tf.ones([2,35,8])
In [4]: c = tf.concat([a,b],axis=0)
In [5]: c.shape
Out[5]: TensorShape([6, 35, 8])
In
在用tensorflow做一维的卷积神经网络的时候会遇到tf.nn.conv1d和layers.conv1d这两个函数,但是这两个函数有什么区别呢,通过计算得到一些规律。
1.关于tf.nn.conv1d的解释,以下是Tensor Flow中关于tf.nn.conv1d的API注解:
Computes a 1-D convolution given 3-D input and filter tensors.
Given an input tensor of shape [batch, in_w
一:原型
concat(values, axis, name=“concat”)。简单理解即将传入的values(若干shape完全一样的N维张量)在指定的维度axis(0<= axis <= N-1)上进行拼接,并返回拼接后的张量。
二:代码分析
1:一维张量
a = tf.constant([1,2])
b = tf.constant([3, 4])
c = tf.concat(values=[a, b], axis=0)
with tf.Session() as sess: