tf.expand_dims( input, axis=None, name=None, dim=None)将维数1插入张量的形状中。(弃用参数)有些论点是不赞成的。...1)) # [2, 1]tf.shape(tf.expand_dims(t, -1)) # [2, 1]# 't2' is a tensor of shape [2, 3, 5]tf.shape(...tf.expand_dims(t2, 0)) # [1, 2, 3, 5]tf.shape(tf.expand_dims(t2, 2)) # [2, 3, 1, 5]tf.shape(tf.expand_dims...(t2, 3)) # [2, 3, 5, 1]这项操作需要: -1-input.dims() 1的维度。...返回值:一个与输入数据相同的张量,但它的形状增加了尺寸为1的额外维数。