File tree Expand file tree Collapse file tree 1 file changed +2
-0
lines changed
source/module_base/module_container/ATen/core Expand file tree Collapse file tree 1 file changed +2
-0
lines changed Original file line number Diff line number Diff line change @@ -324,6 +324,7 @@ Tensor Tensor::operator[](const int& index) const {
324324// Overloaded operator<< for the Tensor class.
325325std::ostream& operator <<(std::ostream& os, const Tensor& tensor) {
326326 std::ios::fmtflags flag (os.flags ());
327+ std::streamsize precision = os.precision (); // save the current precision
327328 const int64_t num_elements = tensor.NumElements ();
328329 const DataType data_type = tensor.data_type ();
329330 const DeviceType device_type = tensor.device_type ();
@@ -398,6 +399,7 @@ std::ostream& operator<<(std::ostream& os, const Tensor& tensor) {
398399#endif
399400 // restore the os settings
400401 os.flags (flag);
402+ os.precision (precision); // restore the precision
401403 return os;
402404}
403405
You can’t perform that action at this time.
0 commit comments