Skip to content

Commit 61b42a8

Browse files
committed
Merged PR 2064: Use ostringstream to replace stringstream
Use ostringstream to replace stringstream
1 parent 8865404 commit 61b42a8

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

lotus/core/framework/bfc_arena.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ struct AllocatorStats {
5353
}
5454

5555
std::string DebugString() const {
56-
std::stringstream ss;
56+
std::ostringstream ss;
5757
ss << "Limit: " << this->bytes_limit << "\n"
5858
<< "InUse: " << this->bytes_in_use << "\n"
5959
<< "TotalAllocate: " << this->total_allocated_bytes_ << "\n"
@@ -162,7 +162,7 @@ class BFCArena : public IArenaAllocator {
162162

163163
std::string DebugString(BFCArena* a,
164164
bool recurse) {
165-
std::stringstream ss;
165+
std::ostringstream ss;
166166
ss << " Size: " << size << " | Requested Size: " << requested_size << " | in_use: " << in_use();
167167
if (recurse && prev != BFCArena::kInvalidChunkHandle) {
168168
Chunk* p = a->ChunkFromHandle(prev);

lotus/core/framework/inference_session.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ class InferenceSession::Impl {
780780
}
781781

782782
void StartProfiling(const std::string& file_prefix) {
783-
std::stringstream ss;
783+
std::ostringstream ss;
784784
ss << file_prefix << "_" << GetCurrentTimeString() << ".json";
785785
session_profiler_.StartProfiling(session_logger_, ss.str());
786786
}

lotus/core/graph/schema_registry.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Lotus::Common::Status LotusOpSchemaRegistry::RegisterOpSchemaInternal(ONNX_NAMES
5959

6060
if (map_[op_name][op_domain].count(ver)) {
6161
const auto& schema = map_[op_name][op_domain][ver];
62-
std::stringstream ostream;
62+
std::ostringstream ostream;
6363
ostream << "Trying to register schema with name " << op_name
6464
<< " (domain: " << op_domain << " version: " << ver
6565
<< ") from file " << op_schema.file() << " line "
@@ -71,7 +71,7 @@ Lotus::Common::Status LotusOpSchemaRegistry::RegisterOpSchemaInternal(ONNX_NAMES
7171

7272
auto ver_range_it = domain_version_range_map_.find(op_domain);
7373
if (ver_range_it == domain_version_range_map_.end()) {
74-
std::stringstream ostream;
74+
std::ostringstream ostream;
7575
ostream << "Trying to register schema with name " << op_name
7676
<< " (domain: " << op_domain << " version: " << ver
7777
<< ") from file " << op_schema.file() << " line "
@@ -80,7 +80,7 @@ Lotus::Common::Status LotusOpSchemaRegistry::RegisterOpSchemaInternal(ONNX_NAMES
8080
return Lotus::Common::Status(Lotus::Common::LOTUS, Lotus::Common::INVALID_ARGUMENT, ostream.str());
8181
}
8282
if (ver > ver_range_it->second.opset_version) {
83-
std::stringstream ostream;
83+
std::ostringstream ostream;
8484
ostream
8585
<< "Trying to register schema with name " << op_name
8686
<< " (domain: " << op_domain << " version: " << ver

lotus/test/framework/TestAllocatorManager.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace Lotus {
44
namespace Test {
55

66
static std::string GetAllocatorId(const std::string& name, const int id, const bool isArena) {
7-
std::stringstream ss;
7+
std::ostringstream ss;
88
if (isArena)
99
ss << "arena_";
1010
else

lotus/test/framework/tensor_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ TEST(TensorTest, ConvertToString) {
200200

201201
EXPECT_EQ(shape.ToString(), "{2,3,4}");
202202

203-
std::stringstream ss;
203+
std::ostringstream ss;
204204
ss << shape;
205205
EXPECT_EQ(ss.str(), "{2,3,4}");
206206
}

0 commit comments

Comments
 (0)