小编wxy*_*wxy的帖子

带有 tf 数据集输入的 Tensorflow keras

我是 tensorflow keras 和数据集的新手。谁能帮我理解为什么下面的代码不起作用?

import tensorflow as tf
import tensorflow.keras as keras
import numpy as np
from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.data.ops import iterator_ops
from tensorflow.python.keras.utils import multi_gpu_model
from tensorflow.python.keras import backend as K


data = np.random.random((1000,32))
labels = np.random.random((1000,10))
dataset = tf.data.Dataset.from_tensor_slices((data,labels))
print( dataset)
print( dataset.output_types)
print( dataset.output_shapes)
dataset.batch(10)
dataset.repeat(100)

inputs = keras.Input(shape=(32,))  # Returns a placeholder tensor

# A layer instance is callable on a tensor, and returns a tensor.
x = keras.layers.Dense(64, activation='relu')(inputs)
x = keras.layers.Dense(64, activation='relu')(x) …
Run Code Online (Sandbox Code Playgroud)

python keras tensorflow tensorflow-datasets

8
推荐指数
2
解决办法
1万
查看次数

标签 统计

keras ×1

python ×1

tensorflow ×1

tensorflow-datasets ×1