@@ -160,7 +160,7 @@ static void __printIndent(std::ostream &stream, int64_t indent)
160
160
161
161
static void printScale (std::ostream & stream, double scale) {
162
162
FormatGuard guard (stream);
163
- stream << defaultfloat << scale << " *" << std::endl ;
163
+ stream << defaultfloat << scale << " *" << ' \n ' ;
164
164
}
165
165
static void __printMatrix (std::ostream& stream, const Tensor& self, int64_t linesize, int64_t indent)
166
166
{
@@ -178,7 +178,7 @@ static void __printMatrix(std::ostream& stream, const Tensor& self, int64_t line
178
178
}
179
179
if (nColumnPerLine < self.size (1 )) {
180
180
if (firstColumn != 0 ) {
181
- stream << std::endl ;
181
+ stream << ' \n ' ;
182
182
}
183
183
stream << " Columns " << firstColumn+1 << " to " << lastColumn+1 ;
184
184
__printIndent (stream, indent);
@@ -193,7 +193,7 @@ static void __printMatrix(std::ostream& stream, const Tensor& self, int64_t line
193
193
for (const auto c : c10::irange (firstColumn, lastColumn+1 )) {
194
194
stream << std::setw (sz) << row_ptr[c]/scale;
195
195
if (c == lastColumn) {
196
- stream << std::endl ;
196
+ stream << ' \n ' ;
197
197
if (l != self.size (0 )-1 ) {
198
198
if (scale != 1 ) {
199
199
__printIndent (stream, indent);
@@ -239,15 +239,15 @@ static void __printTensor(std::ostream& stream, Tensor& self, int64_t linesize)
239
239
if (start) {
240
240
start = false ;
241
241
} else {
242
- stream << std::endl ;
242
+ stream << ' \n ' ;
243
243
}
244
244
stream << " (" ;
245
245
Tensor tensor = self;
246
246
for (const auto i : c10::irange (self.ndimension ()-2 )) {
247
247
tensor = tensor.select (0 , counter[i]);
248
248
stream << counter[i]+1 << " ," ;
249
249
}
250
- stream << " .,.) = " << std::endl ;
250
+ stream << " .,.) = " << ' \n ' ;
251
251
__printMatrix (stream, tensor, linesize, 1 );
252
252
}
253
253
}
@@ -279,7 +279,7 @@ std::ostream& print(std::ostream& stream, const Tensor & tensor_, int64_t linesi
279
279
tensor = tensor_.to (kCPU , kDouble ).contiguous ();
280
280
}
281
281
if (tensor.ndimension () == 0 ) {
282
- stream << defaultfloat << tensor.data_ptr <double >()[0 ] << std::endl ;
282
+ stream << defaultfloat << tensor.data_ptr <double >()[0 ] << ' \n ' ;
283
283
stream << " [ " << tensor_.toString () << " {}" ;
284
284
} else if (tensor.ndimension () == 1 ) {
285
285
if (tensor.numel () > 0 ) {
@@ -289,7 +289,7 @@ std::ostream& print(std::ostream& stream, const Tensor & tensor_, int64_t linesi
289
289
}
290
290
double * tensor_p = tensor.data_ptr <double >();
291
291
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 ' ;
293
293
}
294
294
}
295
295
stream << " [ " << tensor_.toString () << " {" << tensor.size (0 ) << " }" ;
@@ -329,7 +329,7 @@ std::ostream& print(std::ostream& stream, const Tensor & tensor_, int64_t linesi
329
329
if (tensor.getIntrusivePtr ()->autograd_meta ()) {
330
330
auto & fw_grad = tensor._fw_grad (/* level */ 0 );
331
331
if (fw_grad.defined ()) {
332
- stream << " , tangent:" << std::endl << fw_grad;
332
+ stream << " , tangent:" << ' \n ' << fw_grad;
333
333
}
334
334
}
335
335
stream << " ]" ;
0 commit comments