title: TypeError: Can not convert a list into a Tensor or Operation
body: <p>I trying to get the output of the code but error at <code>with tf.control_dependencies()</code>. THe error is shown in below: The original code is came from <a href="https://github.com/CharlesShang/FastMaskRCNN/blob/master/libs/layers/crop.py" rel="nofollow noreferrer">enter link description here</a></p>
  
  <pre><code>Traceback (most recent call last):
    File "croptest.py", line 80, in &lt;module&gt;
      crop(Image,boxes,batch_inds);
    File "croptest.py", line 55, in crop
      with tf.control_dependencies([assert_op, images, batch_inds]):
    File "/home/ubuntu/Desktop/WK/my_project/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 3936, in control_dependencies
      return get_default_graph().control_dependencies(control_inputs)
    File "/home/ubuntu/Desktop/WK/my_project/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 3665, in control_dependencies
      c = self.as_graph_element(c)
    File "/home/ubuntu/Desktop/WK/my_project/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2708, in as_graph_element
      return self._as_graph_element_locked(obj, allow_tensor, allow_operation)
    File "/home/ubuntu/Desktop/WK/my_project/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2797, in _as_graph_element_locked
      % (type(obj).__name__, types_str))
  TypeError: Can not convert a list into a Tensor or Operation.
  </code></pre>
  
  <p>I believe there is no mistake on the code, i just curious how the control dependencies not working even all inputs are given.
  the code i ran is as below:</p>
  
  <pre><code>from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  
  import tensorflow as tf
  import numpy as np
  
  def crop(images, boxes, batch_inds, stride = 1, pooled_height = 2, pooled_width = 2, scope='ROIAlign'):
    """Cropping areas of features into fixed size
    Params:
    --------
    images: a 4-d Tensor of shape (N, H, W, C)
    boxes: rois in the original image, of shape (N, ..., 4), [x1, y1, x2, y2]
    batch_inds: 
  
    Returns:
    --------
    A Tensor of shape (N, pooled_height, pooled_width, C)
    """
    with tf.name_scope(scope):
      #
      boxes = boxes / (stride + 0.0)
      print("boxes again=",boxes)
      boxes = tf.reshape(boxes, [-1, 4])
      print ("2=======================================================")
      print("boxes again=",boxes)
      # normalize the boxes and swap x y dimensions
      shape = tf.shape(images)
      boxes = tf.reshape(boxes, [-1, 2]) # to (x, y)
      print ("3=======================================================")
      print(boxes)
      xs = boxes[:, 0] 
      ys = boxes[:, 1]
      print ("4=======================================================")
      print(xs,ys)
      xs = xs / tf.cast(shape[2], tf.float32)
      ys = ys / tf.cast(shape[1], tf.float32)
      print ("5=======================================================")
      print("again xs,ys",xs,ys)
      boxes = tf.concat([ys[:, tf.newaxis], xs[:, tf.newaxis]], axis=1)
      boxes = tf.reshape(boxes, [-1, 4])  # to (y1, x1, y2, x2)
      print ("6=======================================================")
      print("again boxes", boxes)
       #if batch_inds is False:
      #   num_boxes = tf.shape(boxes)[0]
      #   batch_inds = tf.zeros([num_boxes], dtype=tf.int32, name='batch_inds')
      #   batch_inds = boxes[:, 0] * 0
      #   batch_inds = tf.cast(batch_inds, tf.int32)
  
      # assert_op = tf.Assert(tf.greater(tf.shape(images)[0], tf.reduce_max(batch_inds)), [images, batch_inds])
      assert_op = tf.Assert(tf.greater(tf.size(images), 0), [images, batch_inds])
      print ("7=======================================================")
      print("assert_op", assert_op)
      print ("8=======================================================")
      with tf.control_dependencies([assert_op, images, batch_inds]):
          return  tf.image.crop_and_resize(images, boxes, batch_inds,
                                           [pooled_height, pooled_width],
                                           method='bilinear',
                                           name='Crop')
  </code></pre>
  
  <p>This is the inputs i set:</p>
  
  <pre><code>Image =[[[[1, 1, 1,1], [2, 2, 2,2]], [[3,3, 3, 3], [4,4, 4, 4]]]]
  print ("=======================================================")
  box =  [[1, 1, 2, 2]]
  boxes = tf.constant(box, tf.float32)
  batch_inds=[1]
  batch_inds = np.zeros((4,), dtype=np.int32)
  batch_inds = tf.convert_to_tensor(batch_inds)
  print("boxes=", boxes)
  print (Image)
  print(tf.shape(Image));
  
  crop(Image,boxes,batch_inds);
  </code></pre>
  
  <p>What is wrong with my inputs if i don't want to modified the <code>crop()</code> function?
  Thank you.</p>