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

AttributeError: 'Iterator' object has no attribute '_output_classes' #66

Closed
jamesmgg opened this issue May 22, 2018 · 4 comments
Closed

Comments

@jamesmgg
Copy link

dyld: warning, LC_RPATH $ORIGIN/../../_solib_darwin_x86_64/_U_S_Stensorflow_Spython_C_Upywrap_Utensorflow_Uinternal.so___Utensorflow in /Users/jguajardo/Library/Python/2.7/lib/python/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so being ignored in restricted program because it is a relative path
Generating positive interactions
Generating negative interactions
Generating user features
Generating item features
2018-05-21 20:52:17.596472: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
/Users/jguajardo/Library/Python/2.7/lib/python/site-packages/tensorflow/python/ops/gradients_impl.py:96: UserWarning: Converting sparse IndexedSlices to a dense Tensor of unknown shape. This may consume a large amount of memory.
  "Converting sparse IndexedSlices to a dense Tensor of unknown shape. "
Traceback (most recent call last):
  File "rec.py", line 15, in <module>
    model.fit(interactions, user_features, item_features, epochs=5, verbose=True)
  File "/Users/jguajardo/Library/Python/2.7/lib/python/site-packages/tensorrec/tensorrec.py", line 533, in fit
    n_sampled_items=n_sampled_items)
  File "/Users/jguajardo/Library/Python/2.7/lib/python/site-packages/tensorrec/tensorrec.py", line 601, in fit_partial
    self._build_tf_graph(n_user_features=n_user_features, n_item_features=n_item_features)
  File "/Users/jguajardo/Library/Python/2.7/lib/python/site-packages/tensorrec/tensorrec.py", line 488, in _build_tf_graph
    self._record_graph_hook_names()
  File "/Users/jguajardo/Library/Python/2.7/lib/python/site-packages/tensorrec/tensorrec.py", line 171, in _record_graph_hook_names
    output_classes = hook._output_classes
AttributeError: 'Iterator' object has no attribute '_output_classes'

Is this some weirdness happening because I'm running this on Python 2.7.10?

@jfkirk
Copy link
Owner

jfkirk commented May 22, 2018

Hey @jamesmgg -- this issue is a result of a TensorFlow version mismatch. TensorRec was built on TensorFlow 1.7.0. Try updating your TF version and this error should go away.

Closing for now. If this issue persists, please re-open it.

@arshpreetsingh
Copy link

Hey @jamesmgg -- this issue is a result of a TensorFlow version mismatch. TensorRec was built on > >TensorFlow 1.7.0. Try updating your TF version and this error should go away.

I have tested things till tensorflow 1.12.0 Things are working fine. Although on Tensorflow 1.13.* it is giving error:

AttributeError: 'Iterator' object has no attribute '_output_types'

@skylacking004
Copy link

skylacking004 commented Feb 22, 2019

Hey James, great program. I am having the same error Would I have to then downgrade tensorflow to 1.7.0?:

I installed tensorflow 1.7, downgraded to Python 3.6.5 via homebrew. Everything works fine now.

@yun-zhou-rb
Copy link

In tensorrec.py around line 175, this change should make the code work on Tensorflow 1.14.0

        for graph_iterator_hook_attr_name in self.graph_iterator_hook_attr_names:
            hook = self.__getattribute__(graph_iterator_hook_attr_name)
            iterator_resource_name = hook._iterator_resource.name
            # output_types = hook._output_types
            # output_shapes = hook._output_shapes
            # output_classes = hook._output_classes
            output_types = tf.data.get_output_types(hook)
            output_shapes = tf.data.get_output_shapes(hook)
            output_classes = tf.data.get_output_classes(hook)

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

No branches or pull requests

5 participants