我有一个包含 59536 列和 200 行的大型训练模型,我想使用 tensorflow 的 cnn 进行训练,但我遇到了OutOfMemory
错误。如何拆分我的模型(将其拆分为较小的列)并进行小批量训练?
这是我的代码
# Create the Estimator
mnist_classifier = tf.estimator.Estimator(
model_fn=cnn_model_fn, model_dir="path/to/model")
# Load the data
train_input_fn = tf.estimator.inputs.numpy_input_fn(
x={"x": np.array(training_set.data)},
y=np.array(training_set.target),
num_epochs=None,
batch_size=5, # I added this option but it seems to split my model by lines, I need to split it by column
shuffle=True)
# Train the model
mnist_classifier.train(
input_fn=train_input_fn,
steps=100,
hooks=[logging_hook])