Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
9448cf66
提交
9448cf66
authored
1月 29, 2021
作者:
Brandon T. Willard
提交者:
Brandon T. Willard
1月 29, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix a link in README and add example usage
上级
7d2268d4
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
72 行增加
和
8 行删除
+72
-8
README.rst
README.rst
+68
-4
introduction.txt
doc/introduction.txt
+4
-4
没有找到文件。
README.rst
浏览文件 @
9448cf66
...
...
@@ -19,10 +19,74 @@ Features
Getting started
===============
The documentation is located `here <https://theano-pymc.readthedocs.io/en/latest/>`__.
.. warning::
As development progresses, the legacy documentation may become less applicable.
.. code-block:: python
import aesara
from aesara import tensor as aet
from aesara.printing import debugprint
# Declare two symbolic floating-point scalars
a = aet.dscalar("a")
b = aet.dscalar("b")
# Create a simple example expression
c = a + b
# Convert the expression into a callable object that takes `(a, b)`
# values as input and computes the value of `c`.
f_c = aesara.function([a, b], c)
assert f_c(1.5, 2.5) == 4.0
# Compute the gradient of the example expression with respect to `a`
dc = aesara.grad(c, a)
f_dc = aesara.function([a, b], dc)
assert f_dc(1.5, 2.5) == 1.0
# Compiling functions with `aesara.function` also optimizes
# expression graphs by removing unnecessary operations and
# replacing computations with more efficient ones.
v = aet.vector("v")
M = aet.matrix("M")
d = a/a + (M + a).dot(v)
debugprint(d)
# Elemwise{add,no_inplace} [id A] ''
# |InplaceDimShuffle{x} [id B] ''
# | |Elemwise{true_div,no_inplace} [id C] ''
# | |a [id D]
# | |a [id D]
# |dot [id E] ''
# |Elemwise{add,no_inplace} [id F] ''
# | |M [id G]
# | |InplaceDimShuffle{x,x} [id H] ''
# | |a [id D]
# |v [id I]
f_d = aesara.function([a, v, M], d)
# `a/a` -> `1` and the dot product is replaced with a BLAS function
# (i.e. CGemv)
debugprint(f_d)
# Elemwise{Add}[(0, 1)] [id A] '' 5
# |TensorConstant{(1,) of 1.0} [id B]
# |CGemv{inplace} [id C] '' 4
# |AllocEmpty{dtype='float64'} [id D] '' 3
# | |Shape_i{0} [id E] '' 2
# | |M [id F]
# |TensorConstant{1.0} [id G]
# |Elemwise{add,no_inplace} [id H] '' 1
# | |M [id F]
# | |InplaceDimShuffle{x,x} [id I] '' 0
# | |a [id J]
# |v [id K]
# |TensorConstant{0.0} [id L]
The documentation is located `here <https://aesara.readthedocs.io/en/latest/>`__.
Installation
...
...
doc/introduction.txt
浏览文件 @
9448cf66
...
...
@@ -67,9 +67,9 @@ Aesara's features, but it illustrates concretely what Aesara is.
# create a simple expression
c = a + b
# convert the expression into a callable object that takes
(a,b)
# values as input and computes a value for
c
f = aesara.function([a,b], c)
# convert the expression into a callable object that takes
`(a, b)`
# values as input and computes a value for
`c`
f = aesara.function([a,
b], c)
# bind 1.5 to 'a', 2.5 to 'b', and evaluate 'c'
assert 4.0 == f(1.5, 2.5)
...
...
@@ -79,7 +79,7 @@ Aesara is not a programming language in the normal sense because you
write a program in Python that builds expressions for Aesara. Still it
is like a programming language in the sense that you have to
- declare variables (``a,b``) and give their types
- declare variables (``a,
b``) and give their types
- build expressions for how to put those variables together
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论