buriburisuri / sugartensor

A slim tensorflow wrapper that provides syntactic sugar for tensor variables. This library will be helpful for practical deep learning researchers not beginners.
MIT License
372 stars 63 forks source link

Running GAN example with placeholder for data.train, data.train.label instead of queue runner #9

Open mjdietzx opened 7 years ago

mjdietzx commented 7 years ago
@tf.sg_train_func
def alt_train(sess, opt):
    x_batch, x_label_batch = train_generator.next()
    l_disc = sess.run([loss_disc, train_disc], {x: x_batch, x_label: x_label_batch})[0]  # training discriminator
    l_gen = sess.run([loss_gen, train_gen], {x: x_batch, x_label: x_label_batch})[0]  # training generator
    return np.mean(l_disc) + np.mean(l_gen)

This causes some problems in the function: sugartensor.sg_train.sg_train_func(func)

Specifically, because it is required for x_label and x_label_batch to be passed when calling sess.run() calls to sess.run() like this: sugartensor/sg_train.py#L331 fail.

The error thrown: InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'Placeholder' with dtype float [[Node: Placeholder = Placeholder[dtype=DT_FLOAT, shape=[], _device="/job:localhost/replica:0/task:0/cpu:0"]()]]

My temporary workaround is just to comment out sugartensor/sg_train.py#L331

buriburisuri commented 7 years ago

@mjdietzx Thanks for your information. I'll check this and think about placeholder instead of queue runner.