Skip to content
Snippets Groups Projects

fix getCPUPtr

Merged Maxence Naud requested to merge fix_getCpuPtr into dev
1 file
+ 6
3
Compare changes
  • Side-by-side
  • Inline
@@ -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
Loading