提交 a4e8507e authored 作者: notoraptor's avatar notoraptor

Update doc related to c_support_code().

Update ParamsType.c_code_cache_version().
上级 e378dfe4
...@@ -151,7 +151,7 @@ There are less methods to define for an Op than for a Type: ...@@ -151,7 +151,7 @@ There are less methods to define for an Op than for a Type:
.. method:: c_support_code() .. method:: c_support_code()
Allows you to specify helper functions/structs that the Allows you to specify helper functions/structs (in a string or a list of string) that the
:ref:`op` needs. That code will be reused for each apply of :ref:`op` needs. That code will be reused for each apply of
this op. It will be inserted at global scope. this op. It will be inserted at global scope.
......
...@@ -114,7 +114,7 @@ the most important ones: ...@@ -114,7 +114,7 @@ the most important ones:
.. method:: c_support_code() .. method:: c_support_code()
Allows to add helper functions/structs that the :ref:`type` needs. Allows to add helper functions/structs (in a string or a list of strings) that the :ref:`type` needs.
.. method:: c_compiler() .. method:: c_compiler()
......
...@@ -369,7 +369,7 @@ commonly used. ...@@ -369,7 +369,7 @@ commonly used.
.. method:: c_support_code() .. method:: c_support_code()
Returns a string containing some support C code for this op. This code Returns a string or a list of strings containing some support C code for this op. This code
will be included at the global scope level and can be used to define will be included at the global scope level and can be used to define
functions and structs that will be used by every apply of this op. functions and structs that will be used by every apply of this op.
......
...@@ -152,7 +152,7 @@ class CLinkerObject(object): ...@@ -152,7 +152,7 @@ class CLinkerObject(object):
def c_support_code(self): def c_support_code(self):
""" """
Optional: Return utility code (a string, or a LIST of strings) for use by a `Variable` or `Op` to be Optional: Return utility code (a string, or a list of strings) for use by a `Variable` or `Op` to be
included at global scope prior to the rest of the code for this class. included at global scope prior to the rest of the code for this class.
QUESTION: How many times will this support code be emitted for a graph QUESTION: How many times will this support code be emitted for a graph
......
...@@ -655,7 +655,7 @@ class ParamsType(Type): ...@@ -655,7 +655,7 @@ class ParamsType(Type):
return list(sorted(list(c_support_code_set))) + [final_struct_code] return list(sorted(list(c_support_code_set))) + [final_struct_code]
def c_code_cache_version(self): def c_code_cache_version(self):
return ((1, 8), tuple(t.c_code_cache_version() for t in self.types)) return ((2,), tuple(t.c_code_cache_version() for t in self.types))
# As this struct has constructor and destructor, it could be instanciated on stack, # As this struct has constructor and destructor, it could be instanciated on stack,
# but current implementations of C ops will then pass the instance by value at functions, # but current implementations of C ops will then pass the instance by value at functions,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论