python - 在 Python 中使用 Autograd 包进行渐变
问题描述
我正在尝试使用package.json 复制这个标准示例Autograd
。
虽然我能够从这个存储库复制其他示例,但这个特定示例会引发如下错误:
/home/avuis/anaconda/lib/python3.6/sitepackages/autograd/numpy/numpy_vjps.py:444: FutureWarning:
Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`.
In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
return lambda g: g[idxs]
这个相关版本不兼容吗?如果是这样,有什么快速的方法来解决这个问题?
提前致谢,
解决方案
尝试将您的scipy
软件包更新到较新的版本。我使用的版本是 1.0.0 并且示例有效。
但是,即使进行了更改,此示例也不起作用。它运行没有错误,但不会产生任何结果。我的猜测是 Hessian 和 Jacobian 近似是错误的,并且最小化算法不会收敛。如果尝试使用另一种最小化算法,它确实会收敛(缓慢但稳定)。存储库中应该代表输出的当前图像已经过时,因为在最新版本的代码中,风车中的类数是 3 而不是 5。
推荐阅读
- php - 在 php 和 mysql 中创建多维数组
- java - (Java) 在倒数第二个正斜杠和最后一个正斜杠之后获取字符串值
- ios - 创建一个内部有 2 个 UiView 的水平 Stackview
- spring-cloud-stream - Spring Cloud StreamListener @Output KStream Serdes 似乎不起作用
- python - TypeError:无法将 feed_dict 键解释为张量,需要了解会话和图表
- php-carbon - PHP Carbon 是否具有使用类似 strtotime() 的字符串的日期调整功能接受
- ffmpeg - 浏览器下载视频流而不是播放它
- r - 使用循环在R中读取和写入多个文件
- adfs - What is the default value of concurrent users can login to ADFS saml authentication?
- shopify - 公共 shopify 应用程序将如何呈现给商店访问者