sxjscience commented on issue #3257: Multiple `ResourceRequest::kTempSpace` in a single operator URL: https://github.com/apache/incubator-mxnet/issues/3257#issuecomment-332723522 We can achieve the feature by initialising a workspace with `char` type and cast it to get the other types. For example: ```c++ // The following example allocates space for both a array with int type and an array with real_t type workspace_size = sizeof(int) * int_array_size + sizeof(real_t) * float_array_size; workspace = resource.get_space_typed<xpu, 1, char>(Shape1(workspace_size), s); char* ptr = workspace.dptr_; int_array = Tensor<xpu, 1, int>(reinterpret_cast<int*>(ptr), Shape1(int_array_size), s); ptr += sizeof(int) * int_array_size; float_array = Tensor<xpu, 1, real_t>(reinterpret_cast<real_t*>(ptr), Shape1(float_array_size), s); ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
With regards, Apache Git Services
