2017-12-20 4 views
1

Tensorflow 1.4 바이너리 실행에 'FertileStatsResourceHandleOp'등록되지 않은, python3.5, window7 (64) https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/2_BasicModels/random_forest.py에서 텐서 포리스트 코드를 실행, I가 발생tensorflow.python.framework.errors_impl.NotFoundError : 연산 유형이 NS80011718

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

코드의 문제 :

from __future__ import print_function 

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

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

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

# 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 

# 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]) 

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

# Build the Random Forest 
forest_graph = tensor_forest.RandomForestGraphs(hparams) 
# Get training graph and loss 
train_op = forest_graph.training_graph(X, Y) 
loss_op = forest_graph.training_loss(X, Y) 

# Measure the accuracy 
infer_op, _, _ = forest_graph.inference_graph(X) 
correct_prediction = tf.equal(tf.argmax(infer_op, 1), tf.cast(Y, tf.int64)) 
accuracy_op = tf.reduce_mean(tf.cast(correct_prediction, tf.float32)) 

# Initialize the variables (i.e. assign their default value) and forest resources 
init_vars = tf.group(tf.global_variables_initializer(), 
    resources.initialize_resources(resources.shared_resources())) 

# Start TensorFlow session 
sess = tf.Session() 

# Run the initializer 
sess.run(init_vars) 

# Training 
for i in range(1, num_steps + 1): 
    # Prepare Data 
    # Get the next batch of MNIST data (only images are needed, not labels) 
    batch_x, batch_y = mnist.train.next_batch(batch_size) 
    _, l = sess.run([train_op, loss_op], feed_dict={X: batch_x, Y: batch_y}) 
    if i % 50 == 0 or i == 1: 
     acc = sess.run(accuracy_op, feed_dict={X: batch_x, Y: batch_y}) 
     print('Step %i, Loss: %f, Acc: %f' % (i, l, acc)) 

# Test Model 
test_x, test_y = mnist.test.images, mnist.test.labels 
print("Test Accuracy:", sess.run(accuracy_op, feed_dict={X: test_x, Y: test_y})) 

전체 오류 추적

Traceback (most recent call last): 
    File "C:/Users/Administrator/Desktop/het-health-ming/sleep_stage/py3/sleep_stage_classifcation/test.py", line 35, in <module> 
    forest_graph = tensor_forest.RandomForestGraphs(hparams) 
    File "D:\Anaconda2\envs\py3\lib\site-packages\tensorflow\contrib\tensor_forest\python\tensor_forest.py", line 376, in __init__ 
    tree_variables_class=tree_variables_class) 
    File "D:\Anaconda2\envs\py3\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 "D:\Anaconda2\envs\py3\lib\site-packages\tensorflow\contrib\tensor_forest\python\tensor_forest.py", line 318, in __init__ 
    params, '', self.get_tree_name('stats', tree_num)) 
    File "D:\Anaconda2\envs\py3\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 "D:\Anaconda2\envs\py3\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 "D:\Anaconda2\envs\py3\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper 
    op_def=op_def) 
    File "D:\Anaconda2\envs\py3\lib\site-packages\tensorflow\python\framework\ops.py", line 2958, in create_op 
    set_shapes_for_outputs(ret) 
    File "D:\Anaconda2\envs\py3\lib\site-packages\tensorflow\python\framework\ops.py", line 2209, in set_shapes_for_outputs 
    shapes = shape_func(op) 
    File "D:\Anaconda2\envs\py3\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 "D:\Anaconda2\envs\py3\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 627, in call_cpp_shape_fn 
    require_shape_fn) 
    File "D:\Anaconda2\envs\py3\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 686, in _call_cpp_shape_fn_impl 
    input_tensors_as_shapes, status) 
    File "D:\Anaconda2\envs\py3\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 NS80011718. Make sure the Op and Kernel are registered in the binary running in this process. 

Process finished with exit code 1 

어떤 조언을?

답변

1

문제를 해결해 주시겠습니까? 나는 같은 문제가있다.

나는 문제가 내가 파이썬 2.7/3.5의 여러 버전 조합을 시도 tensorflow 1.4

0

의 버전이 될 것이라고 생각하고 1.4/1.5 tensorflow하지만 난 그것을 밖으로 일을 가져올 수 없습니다. 마지막으로 "sklearn.ensemble import RandomForestClassifier"를 사용하여 솔루션을 다시 구현했습니다.

+0

몇 가지 설명을 추가 할 수 있습니까? –