Python 如何将我的合成数据作为dict输入?

Python 如何将我的合成数据作为dict输入?,python,pandas,tensorflow,neural-network,Python,Pandas,Tensorflow,Neural Network,你好,我是python和tensorflow的新手 我正在基于我拥有的ANN代码实现一个BNN,我发现了一些我正在遵循的教程(),尽管在教程中他们使用的是来自tensorflow数据集的数据集 def get_train_and_test_splits(train_size, batch_size=1): # We prefetch with a buffer the same size as the dataset because th dataset # is very small and

你好,我是python和tensorflow的新手

我正在基于我拥有的ANN代码实现一个BNN,我发现了一些我正在遵循的教程(),尽管在教程中他们使用的是来自tensorflow数据集的数据集

def get_train_and_test_splits(train_size, batch_size=1):
# We prefetch with a buffer the same size as the dataset because th dataset
# is very small and fits into memory.
dataset = (
    tfds.load(name="wine_quality", as_supervised=True, split="train")
    .map(lambda x, y: (x, tf.cast(y, tf.float32)))
    .prefetch(buffer_size=dataset_size)
    .cache()
)
# We shuffle with a buffer the same size as the dataset.
train_dataset = (
    dataset.take(train_size).shuffle(buffer_size=train_size).batch(batch_size)
)
test_dataset = dataset.skip(train_size).batch(batch_size)

return train_dataset, test_dataset
然后,他们正在创建一个包含功能名称的词典

FEATURE_NAMES = [
"fixed acidity",
"volatile acidity",
"citric acid",
"residual sugar",
"chlorides",
"free sulfur dioxide",
"total sulfur dioxide",
"density",
"pH",
"sulphates",
"alcohol",]

def create_model_inputs():
inputs = {}
for feature_name in FEATURE_NAMES:
    inputs[feature_name] = layers.Input(
        name=feature_name, shape=(1,), dtype=tf.float32
    )
return inputs
而在我的例子中,我使用的是合成数据(我从批次中获得)

我想和他一样输入数据,你能指导我这样做吗

PS:在我的旧代码中,这是输入部分:

#input processing
def过程输入(X输入,X输入): r=tf.fill([tf.shape(input=X_input)[0],1],np.float64(0.),name='r')#利率,如适用

S = tf.slice(X_input, (0,0), (-1,1))
K = tf.slice(X_input, (0,1), (-1,1))
T = tf.slice(X_input, (0,2), (-1,1))

S_ = tf.slice(X_input_, (0,0), (-1,1))
T_ = tf.slice(X_input_, (0,1), (-1,1))
return S, K, T, S_, T_, r
S = tf.slice(X_input, (0,0), (-1,1))
K = tf.slice(X_input, (0,1), (-1,1))
T = tf.slice(X_input, (0,2), (-1,1))

S_ = tf.slice(X_input_, (0,0), (-1,1))
T_ = tf.slice(X_input_, (0,1), (-1,1))
return S, K, T, S_, T_, r