@@ -57,152 +57,152 @@ class Tensor
5757{
5858public:
5959 /* *
60- * @brief Default constructor - creates an empty tensor
61- */
60+ * @brief Default constructor - creates an empty tensor
61+ */
6262 Tensor ();
6363
6464 /* *
65- * @brief Create a new tensor with specified shape and data type
66- * @param shape Dimensions of the tensor
67- * @param dtype Data type of tensor elements
68- */
65+ * @brief Create a new tensor with specified shape and data type
66+ * @param shape Dimensions of the tensor
67+ * @param dtype Data type of tensor elements
68+ */
6969 Tensor (const std::vector<size_t > & shape, DataType dtype);
7070
7171 /* *
72- * @brief Wrap existing data in a tensor (non-owning)
73- * @param data Pointer to existing data
74- * @param shape Dimensions of the tensor
75- * @param dtype Data type of tensor elements
76- */
72+ * @brief Wrap existing data in a tensor (non-owning)
73+ * @param data Pointer to existing data
74+ * @param shape Dimensions of the tensor
75+ * @param dtype Data type of tensor elements
76+ */
7777 Tensor (void * data, const std::vector<size_t > & shape, DataType dtype);
7878
7979 /* *
80- * @brief Destructor - frees owned memory
81- */
80+ * @brief Destructor - frees owned memory
81+ */
8282 ~Tensor ();
8383
8484 /* *
85- * @brief Copy constructor - creates a deep copy
86- */
85+ * @brief Copy constructor - creates a deep copy
86+ */
8787 Tensor (const Tensor & other);
8888
8989 /* *
90- * @brief Copy assignment - creates a deep copy
91- */
90+ * @brief Copy assignment - creates a deep copy
91+ */
9292 Tensor & operator =(const Tensor & other);
9393
9494 /* *
95- * @brief Move constructor
96- */
95+ * @brief Move constructor
96+ */
9797 Tensor (Tensor && other) noexcept ;
9898
9999 /* *
100- * @brief Move assignment
101- */
100+ * @brief Move assignment
101+ */
102102 Tensor & operator =(Tensor && other) noexcept ;
103103
104104 /* *
105- * @brief Get tensor dimensions
106- * @return Vector of dimension sizes
107- */
105+ * @brief Get tensor dimensions
106+ * @return Vector of dimension sizes
107+ */
108108 const std::vector<size_t > & shape () const
109109 {
110110 return shape_;
111111 }
112112
113113 /* *
114- * @brief Get memory strides for each dimension
115- * @return Vector of stride sizes in bytes
116- */
114+ * @brief Get memory strides for each dimension
115+ * @return Vector of stride sizes in bytes
116+ */
117117 const std::vector<size_t > & strides () const
118118 {
119119 return strides_;
120120 }
121121
122122 /* *
123- * @brief Get number of dimensions
124- * @return Number of dimensions
125- */
123+ * @brief Get number of dimensions
124+ * @return Number of dimensions
125+ */
126126 size_t rank () const
127127 {
128128 return shape_.size ();
129129 }
130130
131131 /* *
132- * @brief Get data type of tensor elements
133- * @return Data type enum
134- */
132+ * @brief Get data type of tensor elements
133+ * @return Data type enum
134+ */
135135 DataType dtype () const
136136 {
137137 return dtype_;
138138 }
139139
140140 /* *
141- * @brief Get total size of tensor data in bytes
142- * @return Size in bytes
143- */
141+ * @brief Get total size of tensor data in bytes
142+ * @return Size in bytes
143+ */
144144 size_t byte_size () const
145145 {
146146 return byte_size_;
147147 }
148148
149149 /* *
150- * @brief Get raw data pointer
151- * @return Pointer to tensor data
152- */
150+ * @brief Get raw data pointer
151+ * @return Pointer to tensor data
152+ */
153153 void * data ()
154154 {
155155 return data_;
156156 }
157157
158158 /* *
159- * @brief Get raw data pointer (const)
160- * @return Const pointer to tensor data
161- */
159+ * @brief Get raw data pointer (const)
160+ * @return Const pointer to tensor data
161+ */
162162 const void * data () const
163163 {
164164 return data_;
165165 }
166166
167167 /* *
168- * @brief Get typed data pointer
169- * @tparam T Data type to cast to
170- * @return Typed pointer to tensor data
171- */
168+ * @brief Get typed data pointer
169+ * @tparam T Data type to cast to
170+ * @return Typed pointer to tensor data
171+ */
172172 template <typename T>
173173 T * data_as ()
174174 {
175175 return static_cast <T *>(data_);
176176 }
177177
178178 /* *
179- * @brief Get typed data pointer (const)
180- * @tparam T Data type to cast to
181- * @return Const typed pointer to tensor data
182- */
179+ * @brief Get typed data pointer (const)
180+ * @tparam T Data type to cast to
181+ * @return Const typed pointer to tensor data
182+ */
183183 template <typename T>
184184 const T * data_as () const
185185 {
186186 return static_cast <const T *>(data_);
187187 }
188188
189189 /* *
190- * @brief Create a new tensor with different shape but same data
191- * @param new_shape New dimensions (total size must match)
192- * @return New tensor view with different shape
193- */
190+ * @brief Create a new tensor with different shape but same data
191+ * @param new_shape New dimensions (total size must match)
192+ * @return New tensor view with different shape
193+ */
194194 Tensor reshape (const std::vector<size_t > & new_shape) const ;
195195
196196 /* *
197- * @brief Get total number of elements
198- * @return Number of elements
199- */
197+ * @brief Get total number of elements
198+ * @return Number of elements
199+ */
200200 size_t size () const ;
201201
202202 /* *
203- * @brief Check if tensor data is stored contiguously in memory
204- * @return True if contiguous, false otherwise
205- */
203+ * @brief Check if tensor data is stored contiguously in memory
204+ * @return True if contiguous, false otherwise
205+ */
206206 bool is_contiguous () const ;
207207
208208private:
0 commit comments