2 Star 6 Fork 7

mirrors_Qihoo360/tensornet

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
tf_gen_op_wrapper.py 1.17 KB
一键复制 编辑 原始数据 按行查看 历史
James Z.M. Gao 提交于 2025-05-26 16:55 +08:00 . add license headers
#!/usr/bin/env python3
# Copyright 2020-2025 Qihoo Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
from tensorflow.python import _pywrap_python_op_gen
from tensorflow.python.client import pywrap_tf_session as py_tf
lib_file = sys.argv[1]
lib_handle = py_tf.TF_LoadLibrary(lib_file)
lib_ops = py_tf.TF_GetOpList(lib_handle)
wrapper_codes = _pywrap_python_op_gen.GetPythonWrappers(lib_ops).decode()
source_files = sys.argv[2:]
if source_files:
marker = "This file is MACHINE GENERATED! Do not edit."
source_line = f"Original C++ source file: {', '.join(source_files)}"
wrapper_codes = wrapper_codes.replace(marker, f"{marker}\n{source_line}", 1)
print(wrapper_codes)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/mirrors_Qihoo360/tensornet.git
git@gitee.com:mirrors_Qihoo360/tensornet.git
mirrors_Qihoo360
tensornet
tensornet
master

搜索帮助