mercredi 24 mai 2017

Tensorflow : Trainning and test into the same graph with input queues

I am facing to an issue that can't solve with what I found on the internet.

I have build my neural network and connect it to inpute pipeline. Reading data from tfrecord, with tf.train.batch and queueRunners, Coords, etc..

I have build my NN into a python class named "Model" that I use like :

model = Model(...all hyperparameter here...)

...

model.predict()

or

model.step()

All the training phase works very well.

But now I would like to add a test phase every X epoch/step of training.

I really don't know how to do this. I have several idea but I don't find the best one:

  • Duplicate the code into my class to get : loss_train and loss_test, and so on for each node of my graph ? (using sharing variable between train and test)
  • create 2 instance of my model :

model_train = Model(reuse=false)

model_test = Model(reuse=true)

  • use tf.make_template ? I really don't found any good exemple of this fonction ...
  • any other solution ?

I would appreciate any suggestion,

Aucun commentaire:

Enregistrer un commentaire