python - 通过 python 在 MATLAB 中创建 tensorflow 会话
问题描述
我正在尝试通过 MATLAB 使用 Tensorflow,我首先创建了一个脚本“mymod”,如下所示:
# mymod.py
import tensorflow as tf
def run():
with tf.Session() as sess:
a = 1
return a
在 MATLAB 命令窗口中运行脚本函数“run()”:
py.mymod.run()
然后我得到了这个错误:
Error using errors_impl>__exit__ (line 473)
Python Error: NotFoundError: No session factory registered for the given
session options: {target: "" config:} Registered factories are {}.
Error in session>__init__ (line 622)
self._session = tf_session.TF_NewDeprecatedSession(opts, status)
Error in session>__init__ (line 1482)
super(Session, self).__init__(target, graph, config=config)
Error in mymod>run (line 4)
with tf.Session() as sess:
如何解决这个问题?
解决方案
推荐阅读
- sql - SQL Server 删除 ID 列上的值
- python - 在 PowerShell 中将值添加到嵌套对象中,就像在 Python 中一样
- python - 如何使用 Python 访问 Firestore 地理点对象的纬度和经度(这应该很容易!)?
- python - Pandas dataframe plot():x轴日期标签显示但不显示数据
- dynamics-crm - Dynamics CRM 实体安全角色
- javascript - Mongoose:“无法读取未定义的属性 'forEach'”
- python - 无法使用 Subprocess.Popen() 打开文件
- pdf - 获取 AATL 证书以在我的基于云的服务中使用
- python - 所有测试返回 json.decoder.JSONDecodeError:
- xamarin - MvvmCross CloseTo ViewModel