@@ -160,7 +160,7 @@ static void __printIndent(std::ostream &stream, int64_t indent)
160160
161161static void printScale (std::ostream & stream, double scale) {
162162 FormatGuard guard (stream);
163- stream << defaultfloat << scale << " *" << std::endl ;
163+ stream << defaultfloat << scale << " *" << ' \n ' ;
164164}
165165static void __printMatrix (std::ostream& stream, const Tensor& self, int64_t linesize, int64_t indent)
166166{
@@ -178,7 +178,7 @@ static void __printMatrix(std::ostream& stream, const Tensor& self, int64_t line
178178 }
179179 if (nColumnPerLine < self.size (1 )) {
180180 if (firstColumn != 0 ) {
181- stream << std::endl ;
181+ stream << ' \n ' ;
182182 }
183183 stream << " Columns " << firstColumn+1 << " to " << lastColumn+1 ;
184184 __printIndent (stream, indent);
@@ -193,7 +193,7 @@ static void __printMatrix(std::ostream& stream, const Tensor& self, int64_t line
193193 for (const auto c : c10::irange (firstColumn, lastColumn+1 )) {
194194 stream << std::setw (sz) << row_ptr[c]/scale;
195195 if (c == lastColumn) {
196- stream << std::endl ;
196+ stream << ' \n ' ;
197197 if (l != self.size (0 )-1 ) {
198198 if (scale != 1 ) {
199199 __printIndent (stream, indent);
@@ -239,15 +239,15 @@ static void __printTensor(std::ostream& stream, Tensor& self, int64_t linesize)
239239 if (start) {
240240 start = false ;
241241 } else {
242- stream << std::endl ;
242+ stream << ' \n ' ;
243243 }
244244 stream << " (" ;
245245 Tensor tensor = self;
246246 for (const auto i : c10::irange (self.ndimension ()-2 )) {
247247 tensor = tensor.select (0 , counter[i]);
248248 stream << counter[i]+1 << " ," ;
249249 }
250- stream << " .,.) = " << std::endl ;
250+ stream << " .,.) = " << ' \n ' ;
251251 __printMatrix (stream, tensor, linesize, 1 );
252252 }
253253}
@@ -279,7 +279,7 @@ std::ostream& print(std::ostream& stream, const Tensor & tensor_, int64_t linesi
279279 tensor = tensor_.to (kCPU , kDouble ).contiguous ();
280280 }
281281 if (tensor.ndimension () == 0 ) {
282- stream << defaultfloat << tensor.data_ptr <double >()[0 ] << std::endl ;
282+ stream << defaultfloat << tensor.data_ptr <double >()[0 ] << ' \n ' ;
283283 stream << " [ " << tensor_.toString () << " {}" ;
284284 } else if (tensor.ndimension () == 1 ) {
285285 if (tensor.numel () > 0 ) {
@@ -289,7 +289,7 @@ std::ostream& print(std::ostream& stream, const Tensor & tensor_, int64_t linesi
289289 }
290290 double * tensor_p = tensor.data_ptr <double >();
291291 for (const auto i : c10::irange (tensor.size (0 ))) {
292- stream << std::setw (sz) << tensor_p[i]/scale << std::endl ;
292+ stream << std::setw (sz) << tensor_p[i]/scale << ' \n ' ;
293293 }
294294 }
295295 stream << " [ " << tensor_.toString () << " {" << tensor.size (0 ) << " }" ;
@@ -329,7 +329,7 @@ std::ostream& print(std::ostream& stream, const Tensor & tensor_, int64_t linesi
329329 if (tensor.getIntrusivePtr ()->autograd_meta ()) {
330330 auto & fw_grad = tensor._fw_grad (/* level */ 0 );
331331 if (fw_grad.defined ()) {
332- stream << " , tangent:" << std::endl << fw_grad;
332+ stream << " , tangent:" << ' \n ' << fw_grad;
333333 }
334334 }
335335 stream << " ]" ;
0 commit comments