aymericdamien / TensorFlow-Examples

TensorFlow Tutorial and Examples for Beginners (support TF v1 & v2)
Other
43.43k stars 14.94k forks source link

Op type not registered 'FertileStatsResourceHandleOp' #212

Open CBrauer opened 6 years ago

CBrauer commented 6 years ago

I tried tried your code and got an error. The code is:

from __future__ import print_function
import platform

import tensorflow as tf
from tensorflow.contrib.tensor_forest.python import tensor_forest

print("The TensorFlow version is: %s" % tf.__version__)
print("The version of Python is: ", platform.python_version())

# Ignore all GPUs, tf random forest does not benefit from it.
import os
os.environ["CUDA_VISIBLE_DEVICES"] = ""

print('Import MNIST data')
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("/tmp/data/", one_hot=False)

print('Parameters')
num_steps = 500 # Total steps to train
batch_size = 1024 # The number of samples per batch
num_classes = 10 # The 10 digits
num_features = 784 # Each image is 28x28 pixels
num_trees = 10
max_nodes = 1000

print('Input and Target data')
X = tf.placeholder(tf.float32, shape=[None, num_features])
# For random forest, labels must be integers (the class id)
Y = tf.placeholder(tf.int32, shape=[None])

print('Random Forest Parameters')
hparams = tensor_forest.ForestHParams(num_classes=num_classes,
                                      num_features=num_features,
                                      num_trees=num_trees,
                                      max_nodes=max_nodes).fill()

print('Build the Random Forest')
forest_graph = tensor_forest.RandomForestGraphs(hparams)

The error I got is:

The TensorFlow version is: 1.4.0
The version of Python is:  3.6.3
Import MNIST data
Extracting /tmp/data/train-images-idx3-ubyte.gz
Extracting /tmp/data/train-labels-idx1-ubyte.gz
Extracting /tmp/data/t10k-images-idx3-ubyte.gz
Extracting /tmp/data/t10k-labels-idx1-ubyte.gz
Parameters
Input and Target data
Random Forest Parameters
Build the Random Forest
Traceback (most recent call last):
  File "C:\sm\BottleRockets\Python\TensorFlow\random_forest.py", line 39, in <module>
    forest_graph = tensor_forest.RandomForestGraphs(hparams)
  File "C:\Users\Charles\Anaconda3\lib\site-packages\tensorflow\contrib\tensor_forest\python\tensor_forest.py", line 376, in __init__
    tree_variables_class=tree_variables_class)
  File "C:\Users\Charles\Anaconda3\lib\site-packages\tensorflow\contrib\tensor_forest\python\tensor_forest.py", line 350, in __init__
    self.variables.append(tree_variables_class(params, i, training))
  File "C:\Users\Charles\Anaconda3\lib\site-packages\tensorflow\contrib\tensor_forest\python\tensor_forest.py", line 318, in __init__
    params, '', self.get_tree_name('stats', tree_num))
  File "C:\Users\Charles\Anaconda3\lib\site-packages\tensorflow\contrib\tensor_forest\python\ops\stats_ops.py", line 102, in fertile_stats_variable
    container, shared_name=name, name=name)
  File "C:\Users\Charles\Anaconda3\lib\site-packages\tensorflow\contrib\tensor_forest\python\ops\gen_stats_ops.py", line 134, in fertile_stats_resource_handle_op
    shared_name=shared_name, name=name)
  File "C:\Users\Charles\Anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "C:\Users\Charles\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 2958, in create_op
    set_shapes_for_outputs(ret)
  File "C:\Users\Charles\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 2209, in set_shapes_for_outputs
    shapes = shape_func(op)
  File "C:\Users\Charles\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 2159, in call_with_requiring
    return call_cpp_shape_fn(op, require_shape_fn=True)
  File "C:\Users\Charles\Anaconda3\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 627, in call_cpp_shape_fn
    require_shape_fn)
  File "C:\Users\Charles\Anaconda3\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 686, in _call_cpp_shape_fn_impl
    input_tensors_as_shapes, status)
  File "C:\Users\Charles\Anaconda3\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 473, in __exit__
    c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.NotFoundError: Op type not registered 'FertileStatsResourceHandleOp' in binary running on BIGSUR. Make sure the Op and Kernel are registered in the binary running in this process.
Press any key to continue . . .

Any help will be greatly appreciated. Charles

OsamaFaker commented 6 years ago

Hi I am master student and working now on my thesis and I need python deep learning code for intrusion detection to apply on kdd dataset by using tensorflow on spark.

I hope to help me to find this code

Thanks

On 14 Dec 2017 12:22 a.m., "Charles Brauer" notifications@github.com wrote:

I tried tried your code and got an error. The code is:

from future import print_function import platform

import tensorflow as tf from tensorflow.contrib.tensor_forest.python import tensor_forest

print("The TensorFlow version is: %s" % tf.version) print("The version of Python is: ", platform.python_version())

Ignore all GPUs, tf random forest does not benefit from it.

import os os.environ["CUDA_VISIBLE_DEVICES"] = ""

print('Import MNIST data') from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("/tmp/data/", one_hot=False)

print('Parameters') num_steps = 500 # Total steps to train batch_size = 1024 # The number of samples per batch num_classes = 10 # The 10 digits num_features = 784 # Each image is 28x28 pixels num_trees = 10 max_nodes = 1000

print('Input and Target data') X = tf.placeholder(tf.float32, shape=[None, num_features])

For random forest, labels must be integers (the class id)

Y = tf.placeholder(tf.int32, shape=[None])

print('Random Forest Parameters') hparams = tensor_forest.ForestHParams(num_classes=num_classes, num_features=num_features, num_trees=num_trees, max_nodes=max_nodes).fill()

print('Build the Random Forest') forest_graph = tensor_forest.RandomForestGraphs(hparams)

The error I got is:

The TensorFlow version is: 1.4.0 The version of Python is: 3.6.3 Import MNIST data Extracting /tmp/data/train-images-idx3-ubyte.gz Extracting /tmp/data/train-labels-idx1-ubyte.gz Extracting /tmp/data/t10k-images-idx3-ubyte.gz Extracting /tmp/data/t10k-labels-idx1-ubyte.gz Parameters Input and Target data Random Forest Parameters Build the Random Forest Traceback (most recent call last): File "C:\sm\BottleRockets\Python\TensorFlow\random_forest.py", line 39, in forest_graph = tensor_forest.RandomForestGraphs(hparams) File "C:\Users\Charles\Anaconda3\lib\site-packages\tensorflow\contrib\tensor_forest\python\tensor_forest.py", line 376, in init tree_variables_class=tree_variables_class) File "C:\Users\Charles\Anaconda3\lib\site-packages\tensorflow\contrib\tensor_forest\python\tensor_forest.py", line 350, in init self.variables.append(tree_variables_class(params, i, training)) File "C:\Users\Charles\Anaconda3\lib\site-packages\tensorflow\contrib\tensor_forest\python\tensor_forest.py", line 318, in init params, '', self.get_tree_name('stats', tree_num)) File "C:\Users\Charles\Anaconda3\lib\site-packages\tensorflow\contrib\tensor_forest\python\ops\stats_ops.py", line 102, in fertile_stats_variable container, shared_name=name, name=name) File "C:\Users\Charles\Anaconda3\lib\site-packages\tensorflow\contrib\tensor_forest\python\ops\gen_stats_ops.py", line 134, in fertile_stats_resource_handle_op shared_name=shared_name, name=name) File "C:\Users\Charles\Anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "C:\Users\Charles\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 2958, in create_op set_shapes_for_outputs(ret) File "C:\Users\Charles\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 2209, in set_shapes_for_outputs shapes = shape_func(op) File "C:\Users\Charles\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 2159, in call_with_requiring return call_cpp_shape_fn(op, require_shape_fn=True) File "C:\Users\Charles\Anaconda3\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 627, in call_cpp_shape_fn require_shape_fn) File "C:\Users\Charles\Anaconda3\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 686, in _call_cpp_shape_fn_impl input_tensors_as_shapes, status) File "C:\Users\Charles\Anaconda3\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 473, in exit c_api.TF_GetCode(self.status.status)) tensorflow.python.framework.errors_impl.NotFoundError: Op type not registered 'FertileStatsResourceHandleOp' in binary running on BIGSUR. Make sure the Op and Kernel are registered in the binary running in this process. Press any key to continue . . .

Any help will be greatly appreciated. Charles

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/aymericdamien/TensorFlow-Examples/issues/212, or mute the thread https://github.com/notifications/unsubscribe-auth/AgEyscubG3iw6iIcnBdKV2mXEpzZ6Xu5ks5tAE4ogaJpZM4RBQ66 .

amerrendar commented 6 years ago

Hi all, i have the same error with the same code. The error is: NotFoundError: Op type not registered 'FertileStatsResourceHandleOp' in binary running on AMERRENDAR. Make sure the Op and Kernel are registered in the binary running in this process. Where AMERRENDAR is just my user. What am i missing?

Thanks

@Tensorflowbutler

wtbsw commented 6 years ago

The same error tensorflow.python.framework.errors_impl.NotFoundError: Op type not registered 'FertileStatsResourceHandleOp' in binary running on computer. Make sure the Op and Kernel are registered in the binary running in this process.

iuliakhomenko commented 6 years ago

I guess the issue is explained here https://github.com/tensorflow/tensorflow/issues/16855

shreya-cmd commented 3 years ago

This solved my problem: import tensorflow as tf from tensorflow.contrib.tensor_forest.python import tensor_forest from tensorflow.python.ops import resources