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

ValueError: Shape must be rank 1 but is rank 2 for 'strided_slice' (op: 'StridedSlice') with input shapes: [?,3], [1,7], [1,7], [1]. #5

Open
Shafaq-S opened this issue Oct 3, 2020 · 0 comments

Comments

@Shafaq-S
Copy link

Shafaq-S commented Oct 3, 2020

I'm trying to implement this code (not on colab) with tf 1.10 and keras 2.2.2. I have managed to run data-processing.py but taining.py gives the following error:

Traceback (most recent call last):
File "/home/ms-thesis/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1576, in _create_c_op
c_op = c_api.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Shape must be rank 1 but is rank 2 for 'strided_slice' (op: 'StridedSlice') with input shapes: [?,3], [1,7], [1,7], [1].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "training.py", line 189, in
train_classes = classes[index[0:7]]
File "/home/ms-thesis/.local/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 524, in _slice_helper
name=name)
File "/home/ms-thesis/.local/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 690, in strided_slice
shrink_axis_mask=shrink_axis_mask)
File "/home/ms-thesis/.local/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 8232, in strided_slice
name=name)
File "/home/ms-thesis/.local/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/ms-thesis/.local/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 454, in new_func
return func(*args, **kwargs)
File "/home/ms-thesis/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3155, in create_op
op_def=op_def)
File "/home/ms-thesis/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1731, in init
control_input_ops)
File "/home/ms-thesis/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1579, in _create_c_op
raise ValueError(str(e))
ValueError: Shape must be rank 1 but is rank 2 for 'strided_slice' (op: 'StridedSlice') with input shapes: [?,3], [1,7], [1,7], [1].

I have tried reshaping the tensor but that also does not work. Suggestions would be appreciated.

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

1 participant