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

RuntimeError: No C++ shape function registered for standard op: NearestNeighbors #7935

Closed
mahatosourav91 opened this issue Feb 28, 2017 · 14 comments
Assignees
Labels

Comments

@mahatosourav91
Copy link

For bugs or installation issues, please provide the following information.
The more information you provide, the more easily we will be able to offer
help and advice.

What related GitHub issues or StackOverflow threads have you found by searching the web for your problem?

Github issue :- 7524
Stackoverflow question:- here

Environment info

Operating System: Ubuntu 16.04 / Windows

Installed version of CUDA and cuDNN: NO

If installed from binary pip package, provide:

  1. A link to the pip package you installed:
  2. The output from python -c "import tensorflow; print(tensorflow.__version__)". 1.0

If installed from source, provide NO

If possible, provide a minimal reproducible example (We usually don't have time to read hundreds of lines of your code)

from tensorflow.contrib.learn.python.learn.estimators import kmeans as kmeans_lib
from tensorflow.contrib.factorization.python.ops import clustering_ops
import random
import numpy as np
import tensorflow as tf


def input_fn(x):
"""Returns an input_fn"""
def _fn():
       return tf.constant(x), None
return _fn

x = np.array([[random.random() for i in range(198)] for j in range(2384)], dtype=np.float32)
km = kmeans_lib.KMeansClustering(num_clusters=200, initial_clusters=clustering_ops.KMEANS_PLUS_PLUS_INIT)
km.fit(input_fn=input_fn(x), max_steps=300)

What other attempted solutions have you tried?

Hi, I found following 2 lines missing in gen_clustering_ops.py. I believe they should there in the file. If not then please raise a bug. I couldn't find the correct place where the change is to be made
image

Logs or other output that would be helpful

(If logs are large, please upload as attachment or provide link).

File "C:\Users#####\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 1568, in call_with_requiring
return getattr(x, f)
File "C:\Users#####\Anaconda3\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 610, in call_cpp_shape_fn
debug_python_shape_fn, require_shape_fn)
File "C:\Users#####\Anaconda3\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 680, in _call_cpp_shape_fn_impl
"No C++ shape function registered for standard op: %s" % op.type)
RuntimeError: No C++ shape function registered for standard op: NearestNeighbors
@tatatodd
Copy link
Contributor

tatatodd commented Mar 1, 2017

@mahatosourav91 If I understand correctly, the problem occurs on Windows?

@mrry might have some thoughts here; perhaps NearestNeighbors isn't registered correctly on Windows?

@tatatodd tatatodd added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Mar 1, 2017
@mrry
Copy link
Contributor

mrry commented Mar 1, 2017

Quite possibly! The support for unsupported libraries in tf.contrib on Windows is incomplete, and left up to the individual contributors. I'm not sure who owns tf.contrib.factorization, but it'd be great if they could add this.

I'm not sure who owns tf.contrib.factorization, but it'd be great if they could add a shape function for their ops to avoid this error :).

@tatatodd
Copy link
Contributor

tatatodd commented Mar 1, 2017

Perhaps @agarwal-ashish is the right contact to get a NearestNeighbors shape function registered on Windows.

@tatatodd tatatodd added stat:awaiting tensorflower Status - Awaiting response from tensorflower and removed stat:awaiting tensorflower Status - Awaiting response from tensorflower labels Mar 1, 2017
@mrry
Copy link
Contributor

mrry commented Mar 1, 2017

The upside of adding a shape function is that benefits Linux and Windows, and you don't have to mess around with CMake :).

@mahatosourav91
Copy link
Author

@tatatodd this error occur even in ubuntu 16.04

@tatatodd
Copy link
Contributor

tatatodd commented Mar 1, 2017

@mahatosourav91 Ah yes my mistake, a NearestNeighbors shape function will indeed help all platforms. Let's see what @agarwal-ashish has to say on this matter.

@agarwal-ashish
Copy link

I agree that adding a shape function to NearestNeighbors sounds like a good next step to fix this issue. @mahatosourav91 have you tried that / are planning on trying that ?

@mahatosourav91
Copy link
Author

@agarwal-ashish Sorry I have a very little understanding of tensorflow framework right now, so I couldn't find the correct place where the change is to be made. Currently I am working by modifying the gen_clustering_ops.py which I know is a bad idea.

@mahatosourav91
Copy link
Author

@agarwal-ashish It would be very helpful if you can look into this issue 7748 also.

@mrry mrry self-assigned this Mar 7, 2017
@mrry
Copy link
Contributor

mrry commented Mar 7, 2017

I have a fix in the works that will enable tf.contrib.factorization on Windows.

@mahatosourav91
Copy link
Author

@mrry What about linux?

@mrry
Copy link
Contributor

mrry commented Mar 7, 2017

The same change should fix Linux as well.

@vinay-hebb
Copy link

@mrry, I am a newbie to the TensorFlow. Could you please elaborate on the below. I am looking for the resolution as I am facing the same issue.

  1. How would I get the fix related to tf.contrib.factorization? Is there a version number? or a release?
  2. If there is no release associated with fix, how can I reproduce the fix in my environment.

@mrry
Copy link
Contributor

mrry commented May 2, 2017

@vinay-hebb The fix to this issue is included in the 1.1 release.

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

No branches or pull requests

5 participants