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

error:Shape mismatch: y has 2000 cols but z has 1 cols #3

Open
LinneLee opened this issue Jun 8, 2024 · 0 comments
Open

error:Shape mismatch: y has 2000 cols but z has 1 cols #3

LinneLee opened this issue Jun 8, 2024 · 0 comments

Comments

@LinneLee
Copy link

LinneLee commented Jun 8, 2024

when running the code, I got this error message:
Exception has occurred: ValueError (note: full exception trace is shown but execution is paused at: _run_module_as_main)
Shape mismatch: y has 2000 cols but z has 1 cols
Apply node that caused the error: Gemm{no_inplace}(Reshape{2}.0, TensorConstant{2.0}, <TensorType(float32, matrix)>, X.T, TensorConstant{-1.0})
Toposort index: 13
Inputs types: [TensorType(float32, matrix), TensorType(float32, scalar), TensorType(float32, matrix), TensorType(float32, matrix), TensorType(float32, scalar)]
Inputs shapes: [(2000, 1), (), (2000, 100), (100, 2000), ()]
Inputs strides: [(4, 4), (), (400, 4), (4, 400), ()]
Inputs values: ['not shown', array(2., dtype=float32), 'not shown', 'not shown', array(-1., dtype=float32)]
Outputs clients: [[Elemwise{Composite{exp((((-i0) + i1) / i2))}}[(0, 0)](Reshape{2}.0, Gemm{no_inplace}.0, Reshape{2}.0)]]

HINT: Re-running with most Theano optimization disabled could give you a back-trace of when this node was created. This can be done with by setting the Theano flag 'optimizer=fast_compile'. If that does not work, Theano optimizations can be disabled with 'optimizer=None'.
HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and storage map footprint of this apply node.
File "/home/anaconda3/envs/tp-gpd/lib/python3.8/site-packages/theano/compile/function_module.py", line 903, in call
self.fn() if output_subset is None else
ValueError: Shape mismatch: y has 2000 cols but z has 1 cols

During handling of the above exception, another exception occurred:

File "/home/anaconda3/envs/tp-gpd/lib/python3.8/site-packages/theano/compile/function_module.py", line 914, in call
gof.link.raise_with_op(
File "/home/anaconda3/envs/tp-gpd/lib/python3.8/site-packages/six.py", line 718, in reraise
raise value.with_traceback(tb)
File "/home/anaconda3/envs/tp-gpd/lib/python3.8/site-packages/theano/gof/link.py", line 325, in raise_with_op
reraise(exc_type, exc_value, exc_trace)
File "/home/anaconda3/envs/tp-gpd/lib/python3.8/site-packages/theano/compile/function_module.py", line 914, in call
gof.link.raise_with_op(
File "/home/work space/tp_gnn/group_detect/thesne/model/core.py", line 92, in find_sigma
e = update_intervals()
File "/home/work space/tp_gnn/group_detect/thesne/model/dynamic_tsne.py", line 205, in dynamic_tsne
find_sigma(X_shared, sigma_shared, N, perplexity, sigma_iters,
File "/home/work space/tp_gnn/group_detect/thesne/examples/gaussians.py", line 49, in main
Ys = dynamic_tsne(Xs, perplexity=70, lmbda=0.1, verbose=1, sigma_iters=50,
File "/home/work space/tp_gnn/group_detect/thesne/examples/gaussians.py", line 57, in
main()
File "/home/anaconda3/envs/tp-gpd/lib/python3.8/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/anaconda3/envs/tp-gpd/lib/python3.8/runpy.py", line 192, in _run_module_as_main (Current frame)
return _run_code(code, main_globals, None,
ValueError: Shape mismatch: y has 2000 cols but z has 1 cols
Apply node that caused the error: Gemm{no_inplace}(Reshape{2}.0, TensorConstant{2.0}, <TensorType(float32, matrix)>, X.T, TensorConstant{-1.0})
Toposort index: 13
Inputs types: [TensorType(float32, matrix), TensorType(float32, scalar), TensorType(float32, matrix), TensorType(float32, matrix), TensorType(float32, scalar)]
Inputs shapes: [(2000, 1), (), (2000, 100), (100, 2000), ()]
Inputs strides: [(4, 4), (), (400, 4), (4, 400), ()]
Inputs values: ['not shown', array(2., dtype=float32), 'not shown', 'not shown', array(-1., dtype=float32)]
Outputs clients: [[Elemwise{Composite{exp((((-i0) + i1) / i2))}}[(0, 0)](Reshape{2}.0, Gemm{no_inplace}.0, Reshape{2}.0)]]

HINT: Re-running with most Theano optimization disabled could give you a back-trace of when this node was created. This can be done with by setting the Theano flag 'optimizer=fast_compile'. If that does not work, Theano optimizations can be disabled with 'optimizer=None'.
HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and storage map footprint of this apply node.

The error vanishes when I sent only one data (X) with shape (1, -1) in the tsne function, but it seems the wrong way to resolve this since I still can not get correct output. Could you give me some hint to solve this error?

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