Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't train with the tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME') #2

Open
Yannis1995 opened this issue Apr 26, 2018 · 3 comments

Comments

@Yannis1995
Copy link

Yannis1995 commented Apr 26, 2018

When I try to try the network with the padding = "SAME" in the code:
def conv2d(x, W):
return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='VALID')
“””
return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')
“””
in flie net.py,
and the it goes wrong:
in the code: l2_loss = tf.reduce_mean(tf.square(labels - model))
ValueError: Dimensions must be equal, but are 21 and 33 for 'sub' (op: 'Sub') with input shapes: [?,21,21,1], [?,33,33,1].
Can you tell me how to solve this problem? Thanks!

@AnwarUllahKhan
Copy link

@Yannis1995 I have the same problem did you solve that? If yes then please tell me how you solved?

@taburiss3525
Copy link

@Yannis1995 I have the same problem did you solve that? If yes then please tell me how you solved?

Setting padding = 'VALID' makes the code work.

@15732031137
Copy link

@taburiss3525 Hello! First of all, thank you for sharing your ideas here. I recently encountered a problem when I reproduced this program. Can you help me?

Traceback (most recent call last):
File "net.py", line 162, in
train_SRCNN(images)
File "net.py", line 92, in train_SRCNN
train_data, train_label = load_data(train_path)
File "net.py", line 24, in load_data
with h5py.File(path, 'r') as hf:
File "/root/anaconda3/lib/python3.7/site-packages/h5py/_hl/files.py", line 408, in init
swmr=swmr)
File "/root/anaconda3/lib/python3.7/site-packages/h5py/_hl/files.py", line 173, in make_fid
fid = h5f.open(name, flags, fapl=fapl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5f.pyx", line 88, in h5py.h5f.open
OSError: Unable to open file (unable to open file: name = './checkpoint/train.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)

Thank you very much! Looking forward to your reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants