提交 d00e0286 authored 作者: Brandon T. Willard's avatar Brandon T. Willard 提交者: Brandon T. Willard

Correct a typo and some wording in doc/JaxOps.rst

上级 d9c292b9
...@@ -58,8 +58,9 @@ Here’s an example for the Eye Op. ...@@ -58,8 +58,9 @@ Here’s an example for the Eye Op.
.. code:: python .. code:: python
from theano.tensor.basic import Eye from theano.tensor.basic import Eye
@jax_funcify.register(Eye) # The decorater
def jax_funcify_Eye(op): # The function that takes an individual Theano-PyMC Op and returned the JAXified op @jax_funcify.register(Eye) # The decorator
def jax_funcify_Eye(op): # The function that takes an Op and returns its JAX equivalent
dtype = op.dtype dtype = op.dtype
def eye(N, M, k): def eye(N, M, k):
...@@ -87,7 +88,7 @@ https://github.com/pymc-devs/Theano-PyMC/blob/master/tests/link/test_jax.py ...@@ -87,7 +88,7 @@ https://github.com/pymc-devs/Theano-PyMC/blob/master/tests/link/test_jax.py
def test_jax_eye(): def test_jax_eye():
"""Tests jaxification of the Eye operator""" """Tests jaxification of the Eye operator"""
out = tt.eye(3) # Initialize a Theano Op out = tt.eye(3) # Initialize a Theano Op
out_fg = theano.gof.FunctionGraph([], [out]) # Create a Theano FunctionGraph out_fg = theano.gof.FunctionGraph([], [out]) # Create a Theano FunctionGraph
compare_jax_and_py(out_fg, []) # Pas the graph and any inputs to testing function compare_jax_and_py(out_fg, []) # Pas the graph and any inputs to testing function
...@@ -116,31 +117,31 @@ https://docs.python.org/3/library/functools.html#functools.singledispatch ...@@ -116,31 +117,31 @@ https://docs.python.org/3/library/functools.html#functools.singledispatch
.. code:: ipython3 .. code:: ipython3
from functools import singledispatch from functools import singledispatch
class Cow: class Cow:
pass pass
cow = Cow() cow = Cow()
class Dog: class Dog:
pass pass
dog = Dog() dog = Dog()
@singledispatch @singledispatch
def greeting(animal): def greeting(animal):
print("This animal has not been registered") print("This animal has not been registered")
@greeting.register(Cow) @greeting.register(Cow)
def cow_greeting(animal): def cow_greeting(animal):
print("Mooooo") print("Mooooo")
@greeting.register(Dog) @greeting.register(Dog)
def dog_greeting(animal): def dog_greeting(animal):
print("Woof") print("Woof")
greeting(cow) greeting(cow)
greeting(dog) greeting(dog)
greeting("A string object") greeting("A string object")
.. parsed-literal:: .. parsed-literal::
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论