我想把两个不同等级的张量相乘,例如:
tensor A -> (i x j x k x l)
tensor B -> (l x m)
来得到另一个具有这个维度的张量。
tensor C -> (i x j x k x m) = (i x j x k x l)*(l x m)
在tensorflow中,我必须一直进行整形,以获得如下输出
(A.reshape(-1,l)*B).reshape(i,j,k,m)
还有没有其他直接做这个的操作?
我想向TFDS中添加一个TensorFlow数据集,其中包含一组形状未知的秩2张量。为了定义这些特性,我使用了以下特性tfds.features.Tensor(shape=[None, None], dtype=tf.float32)。但是,当我尝试加载数据集时,它会失败,并显示以下错误:
NotImplementedError: Specification error for feature k (TensorInfo(shape=[None, None], dtype=tf.float32)): Tensor with a unknown dimension not at the firs
我有一个形状为(?, 1082)的张量tensor,我想在for循环中将这个张量分成多个子部分,但我想保留原始形状,包括未知的尺寸?。 示例: lst = []
for n in range(15):
sub_tensor = tensor[n] # this will reduce the first dimension
print(sub_tensor.get_shape()) 我正在寻找的打印输出: (?, 1082)
(?, 1082) 等。 如何在TensorFlow中实现这一点?
我试图在tensorflow模型中添加预处理层,但无法正确地使用tf.keras.layers.Reshape。
我有一些以前的预处理层,这些图层会给TensorShape([50, 50, 3])形状的tensorflow张量带来一幅numpy图像。
我试图将这些预处理层连接到模型的第一层是一个卷积层,它需要一个四维的输入。当我调用维数Tensorshape([50,50,3])张量上的模型时,有三个维度,我得到了错误:
Input 0 of layer "Conv1" is incompatible with the layer: expected min_ndim=4,
为了清楚地理解tensorflow中的张量,我需要清楚地了解张量是如何定义的。
以下是tensorflow文档中的一些例子:
3 # a rank 0 tensor; this is a scalar with shape [] [1. ,2., 3.] # a rank 1 tensor; this is a vector with shape [3] [[1., 2., 3.], [4., 5., 6.]] # a rank 2 tensor; a matrix with shape [2, 3] [[[1., 2., 3.]], [[7., 8., 9.]]] # a rank 3 te
我正在尝试使用Tensorflow C API来运行与Deeplab图的会话。Deeplab的冰冻图表,在城市景观上进行了预先训练,可从此处下载:http://download.tensorflow.org/models/deeplabv3_mnv2_cityscapes_train_2018_02_05.tar.gz 当我使用python运行时,我得到以下分段输出: ? 通过python行tensors = [n.values() for n in tf.get_default_graph().get_operations()]打印出图形的所有张量,我发现输入张量的维度是{1,?,?,