| | #ifndef OPENPOSE_CORE_ARRAY_CPU_GPU_HPP |
| | #define OPENPOSE_CORE_ARRAY_CPU_GPU_HPP |
| |
|
| | #include <memory> |
| | #include <vector> |
| | #include <openpose/core/array.hpp> |
| | #include <openpose/core/macros.hpp> |
| |
|
| | namespace op |
| | { |
| | |
| | |
| | |
| | template<typename T> |
| | class ArrayCpuGpu |
| | { |
| | public: |
| | ArrayCpuGpu(); |
| | |
| | |
| | |
| | |
| | explicit ArrayCpuGpu(const void* caffeBlobTPtr); |
| | |
| | |
| | |
| | |
| | |
| | |
| | explicit ArrayCpuGpu(const Array<T>& array, const bool copyFromGpu); |
| | explicit ArrayCpuGpu(const int num, const int channels, const int height, const int width); |
| | |
| |
|
| | void Reshape(const int num, const int channels, const int height, const int width); |
| | void Reshape(const std::vector<int>& shape); |
| | |
| | |
| | |
| | std::string shape_string() const; |
| | const std::vector<int>& shape() const; |
| | int shape(const int index) const; |
| | int num_axes() const; |
| | int count() const; |
| | int count(const int start_axis, const int end_axis) const; |
| | int count(const int start_axis) const; |
| |
|
| | int CanonicalAxisIndex(const int axis_index) const; |
| |
|
| | int num() const; |
| | int channels() const; |
| | int height() const; |
| | int width() const; |
| | int LegacyShape(const int index) const; |
| |
|
| | int offset(const int n, const int c = 0, const int h = 0, const int w = 0) const; |
| | |
| |
|
| | |
| | |
| |
|
| | T data_at(const int n, const int c, const int h, const int w) const; |
| | T diff_at(const int n, const int c, const int h, const int w) const; |
| | |
| | |
| |
|
| | |
| | |
| |
|
| | const T* cpu_data() const; |
| | void set_cpu_data(T* data); |
| | const int* gpu_shape() const; |
| | const T* gpu_data() const; |
| | void set_gpu_data(T* data); |
| | const T* cpu_diff() const; |
| | const T* gpu_diff() const; |
| | T* mutable_cpu_data(); |
| | T* mutable_gpu_data(); |
| | T* mutable_cpu_diff(); |
| | T* mutable_gpu_diff(); |
| | void Update(); |
| | |
| | |
| |
|
| | T asum_data() const; |
| | T asum_diff() const; |
| | T sumsq_data() const; |
| | T sumsq_diff() const; |
| |
|
| | void scale_data(const T scale_factor); |
| | void scale_diff(const T scale_factor); |
| |
|
| | |
| | |
| |
|
| | |
| |
|
| | private: |
| | |
| | |
| | struct ImplArrayCpuGpu; |
| | std::shared_ptr<ImplArrayCpuGpu> spImpl; |
| |
|
| | |
| | |
| | DELETE_COPY(ArrayCpuGpu); |
| | }; |
| |
|
| | |
| | |
| | } |
| |
|
| | #endif |
| |
|