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

I just followed the example, and I get the following error #6

Closed
Navifra-Kerry opened this issue Apr 9, 2019 · 14 comments
Closed

I just followed the example, and I get the following error #6

Navifra-Kerry opened this issue Apr 9, 2019 · 14 comments

Comments

@Navifra-Kerry
Copy link

Traceback (most recent call last):
File "train.py", line 4, in
import cntkx as Cx
File "C:\Anaconda3\lib\site-packages\cntkx_init_.py", line 1, in
from . import layers
File "C:\Anaconda3\lib\site-packages\cntkx\layers_init_.py", line 1, in
from .layers import *
File "C:\Anaconda3\lib\site-packages\cntkx\layers\layers.py", line 316
assert x.shape[0] > 0, f"input tensor must have a defined shape, input shape is {x.shape}"
^
SyntaxError: invalid syntax

D:\GIT\Segmentation\ImageSegmentation>python unettest.py
C:\Anaconda3\lib\site-packages\cntk\cntk_py_init.py:32: UserWarning: Unsupported Windows version (7). CNTK supports Windows 10 and above, only.
warnings.warn('Unsupported Windows version (%s). CNTK supports Windows 10 and above, only.' % my_distro_ver)
Traceback (most recent call last):
File "unettest.py", line 2, in
import cntkx as CX
File "C:\Anaconda3\lib\site-packages\cntkx_init_.py", line 1, in
from . import layers
File "C:\Anaconda3\lib\site-packages\cntkx\layers_init_.py", line 1, in
from .layers import *
File "C:\Anaconda3\lib\site-packages\cntkx\layers\layers.py", line 316
assert x.shape[0] > 0, f"input tensor must have a defined shape, input shape is {x.shape}"
^
SyntaxError: invalid syntax

@delzac
Copy link
Owner

delzac commented Apr 9, 2019

Hi,

The assertion checks if the input tensor into the SinusoidalPositionalEmbedding() has a defined shape. It seems like your input tensor doesn't have a shape.

import cntk as C
import cntkx as Cx

a = C.sequence.input_variable(10)
b = Cx.layers.SinusoidalPositionalEmbedding()(a)
assert b.shape == (10, )

It checks if a has a shape or not. If you still have problems, i please paste your code and i'll help you take a look :)

@Navifra-Kerry
Copy link
Author

https://github.com/kerryJo/ImageSegmentation.git

source is in my repository,
I just imort cntkx but I have problems

@delzac
Copy link
Owner

delzac commented Apr 9, 2019

I couldn't find any import cntkx in your repo, maybe you need to update it to the latest. Did you do a pip install cntkx?

@Navifra-Kerry
Copy link
Author

Yes.
Installed with pip , It happens only with import from that code.

@delzac
Copy link
Owner

delzac commented Apr 10, 2019

Can you uninstall and reinstall cntkx again? I'm on cntkx 0.1.1 and python 3.6 and i can't replicate the bug.

@Navifra-Kerry
Copy link
Author

Navifra-Kerry commented Apr 10, 2019

It is the same install it again.
Is not it possible to use python 3.6.6 anaconda shared environment?

@delzac
Copy link
Owner

delzac commented Apr 10, 2019

hi @kerryJo i have just changed the API of SinusoidalPositionalEmbedding in the newest release of cntkx. Its now in version 0.1.2, please update again using the follow commands:

pip uninstall cntkx
pip install cntkx

It is perfectly fine to use python 3.6.x anaconda environment, i'm using an anaconda envs too.

Create a single a "check_cntkx.py" file with a single line of code:
import cntkx as Cx

If should run without error. Let me know if it works or not!

@Navifra-Kerry
Copy link
Author

Navifra-Kerry commented Apr 10, 2019

Traceback (most recent call last):
File "unettest.py", line 1, in
import cntkx as Cx
File "C:\Anaconda3\lib\site-packages\cntkx_init_.py", line 1, in
from . import layers
File "C:\Anaconda3\lib\site-packages\cntkx\layers_init_.py", line 1, in
from .layers import *
File "C:\Anaconda3\lib\site-packages\cntkx\layers\layers.py", line 452
raise ValueError(f"a constant initializer was passed that is of wrong shape {init.shape}")
^

same error..
What is the problem?ㅠㅠ

@delzac
Copy link
Owner

delzac commented Apr 10, 2019

Is it still a syntax error? I don't think it has anything to do the library, but your python interpreter or envs.

@delzac
Copy link
Owner

delzac commented Apr 10, 2019

Wait, are you sure you are using python3.6, cause it seems like the errors are being raised when f-strings are used.

Python 3.6 allows for f-string.

@Navifra-Kerry
Copy link
Author

ok wait for you

@delzac
Copy link
Owner

delzac commented Apr 10, 2019

@kerryJo please use python3.6 and above when using cntkx. You are getting errors because you are using the wrong python version it seems.

@Navifra-Kerry
Copy link
Author

Thank you. The Python version of the anaconda environment was 3.5. I'll check again after the upgrade.

@delzac
Copy link
Owner

delzac commented Apr 10, 2019

Feel free to reopen this issue again if the issue is not resolved! :)

@delzac delzac closed this as completed Apr 10, 2019
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

2 participants