【发布时间】:2020-04-02 15:31:07
【问题描述】:
# Convert to Tensor
imagepaths = tf.convert_to_tensor(imagepaths, dtype=tf.string)
labels = tf.convert_to_tensor(labels, dtype=tf.int32)
# Build a TF Queue, shuffle data
image, label = tf.data.Dataset.from_tensor_slices([imagepaths, labels])
所以下面的代码是我在 Tensorflow 2 中使用的代码,我不断更改我转换为的类型,但是无论我使用哪个,它都会不断地给我错误。有任何想法吗?下面我列出了我得到的一些错误:
tensorflow.python.framework.errors_impl.InvalidArgumentError: cannot compute Pack as input #1(zero-based) was expected to be a string tensor but is a int32 tensor [Op:Pack] name: component_0
return ops.EagerTensor(value, handle, device, dtype)
TypeError: Cannot convert provided value to EagerTensor
【问题讨论】:
标签: python tensorflow dtype