小编dim*_*n82的帖子

tf.data.Dataset.from_generator 调用的复杂对象的输出签名、输出类型和输出形状示例

我有一个生成器函数,可以生成以下元组:yield (transformed_input_array, set_y)

Transformed_input_array是具有以下形状的 ndarray 列表:(1024, 104), (1024, 142), (1024, 1), (1024, 1), (1024, 1), (1024, 1), (1024, 140) 和以下类型:tf.float64、tf.float64、tf.int8、tf.int16、tf.int8、tf.int8、tf.float64 set_y是形状为1024、类型为int64的ndarray

我用 tf.data.Dataset.from_generator 函数包装了生成器,代码如下:

dataset = tf.data.Dataset.from_generator(
    generator,
    # output_signature=(
    #     tf.TensorSpec(shape=(), dtype=(tf.float64, tf.float64, tf.int8, tf.int16, tf.int8, tf.int8, tf.float64)),
    #     tf.TensorSpec(shape=1024, dtype=tf.int64))
    output_types=(tf.float64, tf.float64, tf.int8, tf.int16, tf.int8, tf.int8, tf.float64, tf.int64),
    output_shapes=((1024, 104), (1024, 142), (1024, 1), (1024, 1), (1024, 1), (1024, 1), (1024, 140), 1024)
)
Run Code Online (Sandbox Code Playgroud)

但是当我运行训练时,出现以下错误:

ValueError: 数据的格式预计为x, (x,) …

tensorflow-datasets tensorflow2.0

8
推荐指数
0
解决办法
2779
查看次数

gcloud.py attributeError:module'enum'没有属性'Int Flag'

我在运行google-cloud-sdk的install.bat(或通过'bash'hell的install.sh)时收到此错误消息.Python是版本3.6.

有什么建议?

python google-cloud-sdk

3
推荐指数
1
解决办法
3702
查看次数