Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/100.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Operation Tensorflow:无法从我的python文件导入用户操作_Operation_Tensorflow - Fatal编程技术网

Operation Tensorflow:无法从我的python文件导入用户操作

Operation Tensorflow:无法从我的python文件导入用户操作,operation,tensorflow,Operation,Tensorflow,我已经成功地运行了教程,并在tensorflow中创建了自己的神经网络实现。然后我决定进一步添加我自己的op,因为我需要对数据进行一些预处理。我在TysFooSoT站点上遵循教程添加了一个OP。在编写了自己的C++文件之后,我成功地构建了TysFraceFrase。然后,当我试图从代码中使用它时,我得到 'module' object has no attribute 'sec_since_midnight' 我的代码确实会反映在bazel genfiles/tensorflow/python

我已经成功地运行了教程,并在tensorflow中创建了自己的神经网络实现。然后我决定进一步添加我自己的op,因为我需要对数据进行一些预处理。我在TysFooSoT站点上遵循教程添加了一个OP。在编写了自己的C++文件之后,我成功地构建了TysFraceFrase。然后,当我试图从代码中使用它时,我得到

'module' object has no attribute 'sec_since_midnight'
我的代码确实会反映在bazel genfiles/tensorflow/python/ops/gen_user_ops.py中,因此包装器的生成是正确的。看起来我看不到tensorflow/python/user_ops/user_ops.py,这就是导入该文件的内容

现在,当我通过这个模块的测试时,我得到了以下奇怪的行为。它不应该通过,因为我给出的预期向量与结果不匹配。但也许测试永远不会执行,尽管说通过了

INFO: Found 1 test target...
Target //tensorflow/python:sec_since_midnight_op_test up-to-date:
  bazel-bin/tensorflow/python/sec_since_midnight_op_test
INFO: Elapsed time: 6.131s, Critical Path: 5.36s
//tensorflow/python:sec_since_midnight_op_test              (1/0 cached) PASSED

Executed 0 out of 1 tests: 1 test passes.
There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings command line option to see which ones these are.

嗯,我卸载了tensorflow,然后重新安装了我刚构建的东西,我写的东西突然被识别出来。我已经连续两次看到这种行为,现在需要卸载。总之,添加我自己的op后的步骤是:

$ pip uninstall tensorflow
$ bazel build -c opt //tensorflow/tools/pip_package:build_pip_package

# To build with GPU support:
$ bazel build -c opt --config=cuda //tensorflow/tools/pip_package:build_pip_package

$ bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg

# The name of the .whl file will depend on your platform.
$ pip install /tmp/tensorflow_pkg/tensorflow-0.5.0-cp27-none-linux_x86_64.whl

嗯,我卸载了tensorflow,然后重新安装了我刚构建的东西,我写的东西突然被识别出来。我已经连续两次看到这种行为,现在需要卸载。总之,添加我自己的op后的步骤是:

$ pip uninstall tensorflow
$ bazel build -c opt //tensorflow/tools/pip_package:build_pip_package

# To build with GPU support:
$ bazel build -c opt --config=cuda //tensorflow/tools/pip_package:build_pip_package

$ bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg

# The name of the .whl file will depend on your platform.
$ pip install /tmp/tensorflow_pkg/tensorflow-0.5.0-cp27-none-linux_x86_64.whl

我现在正在努力导入我自己的自定义op以及。。。你能告诉我你到底是怎么进口的吗?“bazel genfiles/tensorflow/python/ops/gen_user”中应该反映哪些变化?我现在正在努力导入自己的自定义op。。。你能告诉我你到底是怎么进口的吗?“bazel genfiles/tensorflow/python/ops/genu user”中应该反映哪些变化?