提交 19239b85 authored 作者: Joseph Turian's avatar Joseph Turian

Few more updates to Type section of advanced tutorial

上级 181b2dbd
...@@ -230,6 +230,7 @@ compare equal: ...@@ -230,6 +230,7 @@ compare equal:
#. Define ``Double.__eq__`` so that all instances of type Double #. Define ``Double.__eq__`` so that all instances of type Double
are equal. For example: are equal. For example:
.. code-block:: python .. code-block:: python
def __eq__(self, other): def __eq__(self, other):
...@@ -265,14 +266,14 @@ attempt to clear up the confusion: ...@@ -265,14 +266,14 @@ attempt to clear up the confusion:
b;``, ``a``, ``b`` and ``c`` would all be Result instances. b;``, ``a``, ``b`` and ``c`` would all be Result instances.
* A **subclass of Type** represents a set of Type instances that share * A **subclass of Type** represents a set of Type instances that share
structural similarities. In the ``double`` example that we are structural similarities. In the ``double`` example that we are doing,
doing, there is actually only one Type in that set, therefore the there is actually only one Type in that set, therefore the subclass
subclass doesn't represent anything that one of its instances doesn't represent anything that one of its instances doesn't. In this
doesn't. In this case it is a singleton. However, the NDArrayType case it is a singleton, a set with one element. However, the NDArrayType
class which is a subclass of Type represents a set of types of class which is a subclass of Type represents a set of types of tensors
tensors parametrized by their data type or number of dimensions. We parametrized by their data type or number of dimensions. We could say
could say that subclassing Type builds a hierarchy of Types which is that subclassing Type builds a hierarchy of Types which is based upon
based upon structural similarity rather than compatibility. structural similarity rather than compatibility.
Final version Final version
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论