title: tf.estimator.Estimator error message IndexError: tuple index out of range
body: <p>I am new to Tensorflow and Python. I am attempting to train a deep network to use as a simple object detector with Tensorflow using my own images, primarily following the tutorials provided on Tensorflow.org. My operating system is Mac OS X Sierra 10.12.6, and I am using Python 3.6 through Anaconda 3. I have written my images to training and validation tf.records files, and am reading and batching them in using the following file reader and input pipeline:</p>
  
  <pre><code>def read_file(filename_queue):
      reader = tf.TFRecordReader()
      key, record_string = reader.read(filename_queue)
      feature = {'image': tf.FixedLenFeature([], tf.string),
             'label': tf.FixedLenFeature([], tf.int64)}
      features = tf.parse_single_example(record_string, feature)
      image = tf.decode_raw(features['image'], tf.float32)
      image = tf.reshape(image, [224, 224, 1])
      image.set_shape([224, 224, 1])
      image = tf.cast(image, tf.float32) * (1 / 255.0)
      label = tf.cast(features['label'], tf.float32)
      label = tf.reshape(label, [1,])
      return image, label
  
  
  def input_pipeline(filenames, batch_size, read_threads, num_epochs):
      print ('input pipeline ready')
      filename_queue = tf.train.string_input_producer(  
          [filenames], num_epochs=num_epochs, shuffle=True)  
      image, label = [read_file(filename_queue)
      for _ in range(read_threads)]
      min_after_dequeue = 10000
      capacity = min_after_dequeue + 3 * batch_size
      example_batch, label_batch = tf.train.shuffle_batch_join([image, label], 
          batch_size=batch_size, 
      capacity=capacity, min_after_dequeue=min_after_dequeue)
      print('loading batch')
      return example_batch, label_batch
  </code></pre>
  
  <p>I have verified that this reads and batches my input files and labels correctly. I then define a convolutional neural network following the "Building a Convolutional Neural Network" tutorial (altering it for my grayscale images as needed), which I named cnn_model_fn. The training and loss functions are defined in cnn_model_fn as is seen in the tutorial.</p>
  
  <p>I am attempting to perform training and validation using a tf.estimator.Estimator object, loading the batches into the estimator using an input function, code below:</p>
  
  <pre><code>def main(unused_argv):
  # training images and labels
    example_batch, label_batch = input_pipeline(train_path, batch_size, 
      read_threads, num_epochs)
  #validation images and labels
    Vexample_batch, Vlabel_batch = input_pipeline(val_path, batch_size, 
      read_threads, num_epochs)
    classifier = tf.estimator.Estimator(model_fn = cnn_model_fn, 
      model_dir=model_dir)
    tensors_to_log = {"probabilities": "softmax_tensor"}
    logging_hook = tf.train.LoggingTensorHook(tensors=tensors_to_log, 
      every_n_iter=batch_size)
    train_input_fn = tf.estimator.inputs.numpy_input_fn(
            x={"images": np.array(example_batch)},
            y=np.array(label_batch),
            batch_size= batch_size,
            num_epochs=num_epochs,
            shuffle=True)
  
    classifier.train(
        input_fn = train_input_fn,
        steps=int(label_batch.shape[0])/batch_size * num_epochs, hooks=
             [logging_hook])
  
    eval_input_fn = tf.estimator.inputs.numpy_input_fn(
        x={"x": np.array(Vexample_batch)},
        y=np.array(Vlabel_batch),
        num_epochs=1,
        shuffle=False)
    metrics = {
        "accuracy":
            learn.MetricSpec(
                    metric_fn=tf.metrics.accuracy, prediction_key="classes")},
  
    eval_results = classifier.evaluate(input_fn=eval_input_fn, metrics = 
         metrics)
    print(eval_results)
  
  if __name__ == "__main__":
       tf.app.run()
  </code></pre>
  
  <p>The "classifier.train" command causes the following error message: "IndexError: tuple index out of range." I have also tried this not converting the image and label batches to np.arrays, and I get this error message: TypeError: unhashable type: 'Dimension' Full traceback to the first error message is provided at the end of the question. I have also tried using tf.contrib.learn.estimator.fit, both with the above input function and feeding the batches in directly, and am encountering similar problems with that approach. I cannot find any further information on this specific issue, and the Tensorflow.org tutorials are not shedding any more light onto this problem. I feel like I'm probably missing something pretty simple, but I'm at my wit's end trying to solve this. Any help is greatly appreciated. Here's the full traceback:</p>
  
  <pre><code>File "&lt;ipython-input-1-ee71d4ff521a&gt;", line 168, in &lt;module&gt;
      tf.app.run()
  
     File "/Users/BAMF/anaconda3/lib/python3.6/site-
     packages/tensorflow/python/platform/app.py", line 48, in run
      _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  
    File "&lt;ipython-input-1-ee71d4ff521a&gt;", line 151, in main
      steps=int(label_batch.shape[0])/batch_size * num_epochs, hooks=
  [logging_hook])
  
    File "/Users/BAMF/anaconda3/lib/python3.6/site-
  packages/tensorflow/python/estimator/estimator.py", line 241, in train
      loss = self._train_model(input_fn=input_fn, hooks=hooks)
  
    File "/Users/BAMF/anaconda3/lib/python3.6/site-
  packages/tensorflow/python/estimator/estimator.py", line 628, in _train_model
      input_fn, model_fn_lib.ModeKeys.TRAIN)
  
    File "/Users/BAMF/anaconda3/lib/python3.6/site-
  packages/tensorflow/python/estimator/estimator.py", line 499, in 
  _get_features_and_labels_from_input_fn
      result = self._call_input_fn(input_fn, mode)
  
    File "/Users/BAMF/anaconda3/lib/python3.6/site-
   packages/tensorflow/python/estimator/estimator.py", line 585, in 
     _call_input_fn
       return input_fn(**kwargs)
  
   File "/Users/BAMF/anaconda3/lib/python3.6/site-
   packages/tensorflow/python/estimator/inputs/numpy_io.py", line 109, in i 
     nput_fn
          if len(set(v.shape[0] for v in ordered_dict_x.values())) != 1:
  
    File "/Users/BAMF/anaconda3/lib/python3.6/site-
  packages/tensorflow/python/estimator/inputs/numpy_io.py", line 109, in 
  &lt;genexpr&gt;
      if len(set(v.shape[0] for v in ordered_dict_x.values())) != 1:
  
  IndexError: tuple index out of range
  </code></pre>