SRGAN icon indicating copy to clipboard operation
SRGAN copied to clipboard

InvalidArgumentError

Open AndrzejBandurski opened this issue 6 years ago • 4 comments

https://github.com/tensorlayer/srgan/blob/068aca5450a712a66c646d43ff6595f13c4eb472/train.py#L330

after training I was trying to run the evaluation but got this error..

tensorflow.python.framework.errors_impl.InvalidArgumentError: cannot compute Conv2D as input #1(zero-based) was expected to be a double tensor but is a float tensor [Op:Conv2D] name: conv2d_1

AndrzejBandurski avatar Jun 30 '19 14:06 AndrzejBandurski

make sure your input is dtype=np.float32

zsdonghao avatar Jun 30 '19 14:06 zsdonghao

what do you mean ??

after getting the model ( get_G from model.py )and loading the trained weights ( G.load_weights )the model gets printed ( pring(G) ) and there comes the error. G.eval() nothing goes is as input yet !

can't you please be more specific ? your comment right now is meaningless for me :(

AndrzejBandurski avatar Jun 30 '19 14:06 AndrzejBandurski

tensorflow.python.framework.errors_impl.InvalidArgumentError: cannot compute Conv2D as input #1(zero-based) was expected to be a double tensor but is a float tensor [Op:Conv2D] name: conv2d_1

this error only happen when the data type of your input is float64, simply change the data to float32 can solve the problem.

I have no idea what is happening on your side...

zsdonghao avatar Jun 30 '19 14:06 zsdonghao

I add a line here to force all images to be float32, hope it helps https://github.com/tensorlayer/srgan/blob/master/train.py#L332

zsdonghao avatar Jun 30 '19 14:06 zsdonghao