我正在使用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])