如何按列拆分张量流的cnn模型并进行小批量训练

时间:2018-01-13 01:34:01

标签: python tensorflow tensorflow-estimator

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

0 个答案:

没有答案