提交 02c9382b authored 作者: Oscar Gustafsson's avatar Oscar Gustafsson 提交者: Thomas Wiecki

Do not use old `T` alias in documentation.

Closes #703. (I've searched and these are the ones I found.)
上级 20581c3f
...@@ -45,7 +45,7 @@ The equivalent Aesara code would be: ...@@ -45,7 +45,7 @@ The equivalent Aesara code would be:
# Symbolic description of the result # Symbolic description of the result
result, updates = aesara.scan(fn=lambda prior_result, A: prior_result * A, result, updates = aesara.scan(fn=lambda prior_result, A: prior_result * A,
outputs_info=T.ones_like(A), outputs_info=aet.ones_like(A),
non_sequences=A, non_sequences=A,
n_steps=k) n_steps=k)
...@@ -174,7 +174,7 @@ downcast** of the latter. ...@@ -174,7 +174,7 @@ downcast** of the latter.
seq = aet.arange(up_to) seq = aet.arange(up_to)
# An unauthorized implicit downcast from the dtype of 'seq', to that of # An unauthorized implicit downcast from the dtype of 'seq', to that of
# 'T.as_tensor_variable(0)' which is of dtype 'int8' by default would occur # 'aet.as_tensor_variable(0)' which is of dtype 'int8' by default would occur
# if this instruction were to be used instead of the next one: # if this instruction were to be used instead of the next one:
# outputs_info = aet.as_tensor_variable(0) # outputs_info = aet.as_tensor_variable(0)
......
...@@ -562,7 +562,7 @@ It will be used repeatedly. ...@@ -562,7 +562,7 @@ It will be used repeatedly.
print(b.get_value()) print(b.get_value())
# Construct Aesara expression graph # Construct Aesara expression graph
p_1 = 1 / (1 + aet.exp(-T.dot(x, w) - b)) # Probability that target = 1 p_1 = 1 / (1 + aet.exp(-aet.dot(x, w) - b)) # Probability that target = 1
prediction = p_1 > 0.5 # The prediction thresholded prediction = p_1 > 0.5 # The prediction thresholded
xent = -y * aet.log(p_1) - (1-y) * aet.log(1-p_1) # Cross-entropy loss function xent = -y * aet.log(p_1) - (1-y) * aet.log(1-p_1) # Cross-entropy loss function
cost = xent.mean() + 0.01 * (w ** 2).sum() # The cost to minimize cost = xent.mean() + 0.01 * (w ** 2).sum() # The cost to minimize
......
...@@ -124,7 +124,7 @@ do is to loop over the entries in *y* and compute the gradient of ...@@ -124,7 +124,7 @@ do is to loop over the entries in *y* and compute the gradient of
>>> import aesara.tensor as aet >>> import aesara.tensor as aet
>>> x = aet.dvector('x') >>> x = aet.dvector('x')
>>> y = x ** 2 >>> y = x ** 2
>>> J, updates = aesara.scan(lambda i, y, x : aet.grad(y[i], x), sequences=T.arange(y.shape[0]), non_sequences=[y, x]) >>> J, updates = aesara.scan(lambda i, y, x : aet.grad(y[i], x), sequences=aet.arange(y.shape[0]), non_sequences=[y, x])
>>> f = aesara.function([x], J, updates=updates) >>> f = aesara.function([x], J, updates=updates)
>>> f([4, 4]) >>> f([4, 4])
array([[ 8., 0.], array([[ 8., 0.],
...@@ -163,7 +163,7 @@ scalar. ...@@ -163,7 +163,7 @@ scalar.
>>> y = x ** 2 >>> y = x ** 2
>>> cost = y.sum() >>> cost = y.sum()
>>> gy = aet.grad(cost, x) >>> gy = aet.grad(cost, x)
>>> H, updates = aesara.scan(lambda i, gy,x : aet.grad(gy[i], x), sequences=T.arange(gy.shape[0]), non_sequences=[gy, x]) >>> H, updates = aesara.scan(lambda i, gy,x : aet.grad(gy[i], x), sequences=aet.arange(gy.shape[0]), non_sequences=[gy, x])
>>> f = aesara.function([x], H, updates=updates) >>> f = aesara.function([x], H, updates=updates)
>>> f([4, 4]) >>> f([4, 4])
array([[ 2., 0.], array([[ 2., 0.],
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论