Skip to content
Snippets Groups Projects
Commit b3f36f6b authored by Maxence Naud's avatar Maxence Naud
Browse files

Merge branch 'fix_getCpuPtr' into 'dev'

fix getCPUPtr

See merge request !84
parents da8c26ab 7fa2e6dd
No related branches found
No related tags found
2 merge requests!105version 0.2.0,!84fix getCPUPtr
Pipeline #39362 passed
...@@ -12,13 +12,16 @@ ...@@ -12,13 +12,16 @@
#ifndef AIDGE_CPU_DATA_GETCPUPTR_H_ #ifndef AIDGE_CPU_DATA_GETCPUPTR_H_
#define AIDGE_CPU_DATA_GETCPUPTR_H_ #define AIDGE_CPU_DATA_GETCPUPTR_H_
#include <cstddef>
#include <memory>
#include "aidge/data/Tensor.hpp" #include "aidge/data/Tensor.hpp"
namespace Aidge { namespace Aidge {
inline void *getCPUPtr(std::shared_ptr<Aidge::Data> const &data) { inline void *getCPUPtr(std::shared_ptr<Aidge::Data> const &data, const std::size_t offset = 0) {
const auto tensor = std::static_pointer_cast<Tensor>(data); const auto tensor = std::static_pointer_cast<Tensor>(data);
return tensor->getImpl()->hostPtr(tensor->getImplOffset()); return tensor->getImpl()->hostPtr(tensor->getImplOffset() + offset);
} }
} // namespace Aidge } // namespace Aidge
#endif // AIDGE_CPU_DATA_GETCPUPTR_H_ #endif // AIDGE_CPU_DATA_GETCPUPTR_H_
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment