提交 2abdde41 authored 作者: Samira Shabanian's avatar Samira Shabanian

NaN Introduced by AllocEmpty

上级 a536464a
...@@ -76,3 +76,11 @@ Cuda Specific Option ...@@ -76,3 +76,11 @@ Cuda Specific Option
The Theano flag ``nvcc.fastmath=True`` can genarate NaN. Don't set The Theano flag ``nvcc.fastmath=True`` can genarate NaN. Don't set
this flag while debugging NaN. this flag while debugging NaN.
NaN Introduced by AllocEmpty
-----------------------------------------------
AllocEmpty is used by many operation such as scan to allocate some memory without properly clearing it. The reason for that is that the allocated memory will subsequently be overwritten. However, this can sometimes introduce NaN depending on the operation and what was previously stored in the memory it is working on. For instance, trying to zero out memory using a multipication before applying an operation could cause NaN if NaN is already present in the memory, since `0 * NaN => NaN`.
Using ``optimizer_including=alloc_empty_to_zeros`` replaces `AllocEmpty` by `Alloc{0}`, which is helpful to diagnose where NaNs come from. Please note that when running in `NanGuardMode`, this optimizer is not included by default. Therefore, it might be helpful to use them both together.
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论