The tensorflow example CIFAR10 uses input pipelines to load data from the disk to a queue. I would like to implement this for my own models, but I run into an error that I can't fix somehow. My minimal example looks like the following (taken from the tutorials: https://www.tensorflow.org/programmers_guide/reading_data):
def read_sample_of_csv(filename_queue): # Define Reader reader = tf.TextLineReader() key,value = reader.read(filename_queue) # Decode CSV record_defaults = [[1.],[1.],[1.],[1.],[1.],[1.],[1.],[1.],[1.],[1.]] col0, *col = tf.decode_csv(value, record_defaults=record_defaults) features = tf.stack([*col]) reference = col0 # Return return features, reference def input_pipeline(filenames, batch_size, ...): # Reader for samples slipangle_filename_queue = tf.train.string_input_producer(filenames, shuffle=shuffle) features, reference = read_sample_of_csv(slipangle_filename_queue) # Batch samples capacity = min_after_dequeue + (num_threads+3) * batch_size feature_batch, reference_batch = tf.train.shuffle_batch([features,reference], batch_size=batch_size) # Return return feature_batch, reference_batch with tf.device(MY_DEVICE): feature_batch, ref_batch = input_pipeline(filenames, batch_size, ...)
This is basically what is done in CIFAR10, just with a csv. The script runs with MY_DEVICE = '/cpu:0', but when I try to run it on the GPU with MY_DEVICE = '/gpu:0' I get the following error:
InvalidArgumentError (see above for traceback): Cannot assign a device to node 'shuffle_batch/random_shuffle_queue': Could not satisfy explicit device specification '/device:GPU:0' because no supported kernel for GPU devices is available. Colocation Debug Info: Colocation group had the following types and devices: QueueEnqueue: CPU QueueSize: CPU QueueClose: CPU QueueDequeueMany: CPU RandomShuffleQueue: CPU [[Node: shuffle_batch/random_shuffle_queue = RandomShuffleQueue[capacity=1500, component_types=[DT_FLOAT, DT_FLOAT], container="", min_after_dequeue=1000, seed=0, seed2=0, shapes=[, ], shared_name="", _device="/device:GPU:0"]()]]
Can I not use input pipelines on GPUs? Isn't this what is done in CIFAR10?