@@ -101,6 +101,15 @@ namespace TRT {
101101 Tensor& set_to (float value);
102102 bool empty ();
103103
104+ template <typename ... _Args>
105+ int offset (int index, _Args ... index_args){
106+ const int index_array[] = {index, index_args...};
107+ return offset_array (sizeof ...(index_args) + 1 , index_array);
108+ }
109+
110+ int offset_array (const std::vector<int >& index);
111+ int offset_array (size_t size, const int * index_array);
112+
104113 template <typename ... _Args>
105114 Tensor& resize (int dim_size, _Args ... dim_size_args){
106115 const int dim_size_array[] = {dim_size, dim_size_args...};
@@ -114,20 +123,11 @@ namespace TRT {
114123
115124 Tensor& to_gpu (bool copyedIfCPU = true );
116125 Tensor& to_cpu (bool copyedIfGPU = true );
117- Tensor& to_half ();
118126
127+ Tensor& to_half ();
119128 Tensor& to_float ();
120129 inline void * cpu () const { ((Tensor*)this )->to_cpu (); return data_->cpu (); }
121130 inline void * gpu () const { ((Tensor*)this )->to_gpu (); return data_->gpu (); }
122-
123- template <typename ... _Args>
124- int offset (int index, _Args ... index_args){
125- const int index_array[] = {index, index_args...};
126- return offset (sizeof ...(index_args) + 1 , index_array);
127- }
128-
129- int offset (const std::vector<int >& index);
130- int offset (size_t size, const int * index_array);
131131
132132 template <typename DType> inline const DType* cpu () const { return (DType*)cpu (); }
133133 template <typename DType> inline DType* cpu () { return (DType*)cpu (); }
0 commit comments