Take a function from the C API like `MXNDArrayGetShape`, which sets a pointer 
to shape data of an `NDArray`. 

It is not documented at 
https://mxnet.incubator.apache.org/doxygen/c__api_8h.html#a2035651f4392d249d1b904d5eb0c3406
 how long this data lasts, where and how it as allocated, and whether the 
caller is responsible for freeing it.

By chasing things down to `MXAPIThreadLocalEntry` I see that this shape buffer 
is thread-local and will last until the next call to either `MXNDArrayGetShape` 
or `MXSymbolInferShape`. That's an important fact to document to be able to use 
the API correctly! If this is documented already somewhere, that's good, but 
then a reference to this section should be included in a doxygen `warn` field 
of `MXNDArrayGetShape` etc. 

[ Full content available at: 
https://github.com/apache/incubator-mxnet/issues/12394 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to