title: tf.io.read_file unable to find file or directory from a numpy array
body: <p>For tensor flow data base loading, I saved a numpy array from my database. </p>
  
  <pre><code>images= train_dataset[i]
  image_string = tf.io.read_file(images)
  </code></pre>
  
  <p>This is a part of my training function. And it seems to be failing.</p>
  
  <p>The issue is </p>
  
  <pre><code>(iP6)21.jpg; No such file or directory
  </code></pre>
  
  <p>Any help appreciated.</p>
  
  <p>Edited to explain the whole code:</p>
  
  <p>train_dataset is a variable to hold a numpy file.</p>
  
  <pre><code>train_dataset=X_train_shuffled
  </code></pre>
  
  <p>for the sake of completeness, here is the entire training function</p>
  
  <pre><code>'training'
  import time
  import tensorflow as tf
  #from tensorflow import read_file
  def train():
      data=filenames_shuffled
      data
      info=y_labels_one_hot_shuffled
      #data, info = tfds.load("mnist", with_info=True, data_dir='/data/tensorflow_datasets')
      #train_data = data['train']
      train_data=X_train_filenames
  
      if not os.path.exists('./images'):
          os.makedirs('./images')
  
      # settting hyperparameter
      latent_dim = 100
      epochs = 800
      batch_size = 32
      buffer_size = 6000
      save_interval = 50
  
      img_shape = (32, 32, 3)
  
      #num_classes = info.features['label'].num_classes
      #num_classes=10
      num_classes=y_train
      generator = Generator(num_classes)
      discriminator = Discriminator(num_classes)
  
      gen_optimizer = tf.keras.optimizers.Adam(0.0002, 0.5)
      disc_optimizer = tf.keras.optimizers.Adam(0.0002, 0.5)
  
      #train_dataset = train_data.map(lambda x: preprocess_image(x, img_shape, num_classes)).shuffle(buffer_size).batch(batch_size)
      train_dataset=train_data
      cross_entropy = tf.keras.losses.BinaryCrossentropy(from_logits=True)
  
      @tf.function
      def train_step(images, labels):
          noise = tf.random.normal([batch_size, latent_dim])
  
          with tf.GradientTape(persistent=True) as tape:
              generated_images = generator(noise, labels)
  
              real_output = discriminator(images, labels)
              generated_output = discriminator(generated_images, labels)
  
              gen_loss = generator_loss(cross_entropy, generated_output)
              disc_loss = discriminator_loss(cross_entropy, real_output, generated_output)
  
          grad_gen = tape.gradient(gen_loss, generator.trainable_variables)
          grad_disc = tape.gradient(disc_loss, discriminator.trainable_variables)
  
          gen_optimizer.apply_gradients(zip(grad_gen, generator.trainable_variables))
          disc_optimizer.apply_gradients(zip(grad_disc, discriminator.trainable_variables))
  
          return gen_loss, disc_loss
  
      seed = tf.random.normal([16, latent_dim])
      #train_dataset.append(y_train)
      #train_dataset=np.append(train_dataset,y_train)
      for epoch in range(1, epochs + 1):
          start = time.time()
          total_gen_loss = 0
          total_disc_loss = 0
          #for images in filenames_shuffled and labels in y_labels_one_hot_shuffled:
          '''
          Trying an alternate for loop thing. As your numpy cannot be called
          for images,labels in train_dataset():
              gen_loss, disc_loss = train_step(images, labels)
  
              total_gen_loss += gen_loss
              total_disc_loss += disc_loss
          '''
          i=0
          #print(train_dataset)
          #print("done")
          #print(y_train)
          while i&lt;2200:
            images= train_dataset[i]
            labels=y_train[i]
            '''
            added this region. Not sure what is happening
            Input filename tensor must be scalar, but had shape: [2200] [Op:ReadFile]
            '''
  
            image_string = tf.io.read_file(images)
            image_decoded = tf.image.decode_jpeg(image_string, channels=3)
            images = tf.cast(image_decoded, tf.float32)
            '''
            till here
            '''
            #filenames_shuffled_numpy, y_labels_one_hot_shuffled
            #print("No error")
            gen_loss, disc_loss = train_step(images, labels)
            #print("error")
            total_gen_loss += gen_loss
            total_disc_loss += disc_loss
            i=i+1
          print('Time for epoch {} is {} sec - gen_loss = {}, disc_loss = {}'.format(epoch, time.time() - start, total_gen_loss / batch_size, total_disc_loss / batch_size))
          if epoch % save_interval == 0:
              save_imgs(epoch, generator, seed)
  
  
  if __name__ == "__main__":
      train()
  </code></pre>
  
  <p>If you need more information, I will happily provide it</p>