获取Tensor维度的两种方法: Tensor.get_shape() 返回TensorShape对象, 如果需要确定的数值而把TensorShape当作list使用,肯定是不行的. 需要调用TensorShape的as_list()方法, 需要调用TensorShape.as_list()方法来获取维度数值. 来实践一下: import tensorflow as tf a = tf.zeros(shape=[10,20]) b = a.get_shape() c = b.as_list()…
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html140/strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>…