提交 35f11b20 authored 作者: notoraptor's avatar notoraptor

Add doc for `c_element_type()` into tutorial for Theano types in C.

上级 6137418f
...@@ -130,6 +130,16 @@ the most important ones: ...@@ -130,6 +130,16 @@ the most important ones:
change in the code. If you don't want to cache the compiled code change in the code. If you don't want to cache the compiled code
return an empty tuple or don't implement it. return an empty tuple or don't implement it.
.. method:: c_element_type()
Optional: should return the name of the primitive C type of
items into variables handled by this Theano type. For example,
for a matrix of 32-bit signed NumPy integers, it should return
``"npy_int32"``. If C type may change from an instance to another
(e.g. ``Scalar('int32')`` vs ``Scalar('int64')``), consider
implementing this method. If C type is fixed accross instances,
this method may be useless (as you already know the C type
when you work with the C code).
Each of these functions take two arguments, ``name`` and ``sub`` which Each of these functions take two arguments, ``name`` and ``sub`` which
must be used to parameterize the C code they return. ``name`` is a must be used to parameterize the C code they return. ``name`` is a
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论