wkcn commented on issue #20343:
URL:
https://github.com/apache/incubator-mxnet/issues/20343#issuecomment-863846142
Thank you for pointing it out : )
It is a confusing variable name, but it is not a bug.
The meanings of `decay_alloc_` and `decay_alloc` are different.
The former `decay_alloc_` is an argument to decide whether the chunk need to
decay-allocated.
But the later `decay_alloc` is the state whether the memory has not been
allocated.
For the two cases `decay_alloc_` is `true` or `false`,
- When the argument `decay_alloc_` is `true`,
1. `decay_alloc = true;`
2. the condition `if (!delay_alloc_)` does not be satisfied.
- When the argument `decay_alloc_` is `false`, the following steps will be
executed:
1. `decay_alloc = true;`
2. The condition `if (!decay_alloc)` is satisfied, then the function
`CheckAndAlloc()` be called.
3. Allocate the memory for the chunk, then `decay_alloc` is set as
`false`.
https://github.com/apache/incubator-mxnet/blob/b54b7f36c944b933f2aa94f224821548da5fcaf6/include/mxnet/ndarray.h#L1018-L1026
`CheckAndAlloc()` will allocate memory when `decay_alloc` is `True`.
Therefore, `decay_alloc` should be `true` whenever `decay_alloc_` is `true`
or `false`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]