File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -32,10 +32,14 @@ def test_dump_graph_with_dynamo_execution(self):
3232 xla_y = torch .tensor (200.0 ).to (device )
3333 res_xla_dynamo = self .fn_simple_dynamo (xla_x , xla_y )
3434 with open (save_file , 'rb' ) as f :
35- current_line = sum (1 for line in f )
35+ lines = f .readlines ()
36+ current_line = len (lines )
37+ self .assertIn ('Graph Hash:' , lines [- 5 ].decode ())
3638 with open (save_file , 'rb' ) as f :
3739 res_xla_dynamo_2 = self .fn_simple_dynamo (xla_x , xla_y )
38- new_line = sum (1 for line in f )
40+ lines = f .readlines ()
41+ new_line = len (lines )
42+ self .assertIn ('Graph Hash:' , lines [- 5 ].decode ())
3943 self .assertGreater (new_line , current_line )
4044
4145
Original file line number Diff line number Diff line change @@ -146,8 +146,11 @@ void XLAGraphExecutor::DeviceContextArena::SaveGraphAsString(
146146 " " ;
147147 if (should_save_graph &&
148148 hash_to_graph_map.find (hash) == hash_to_graph_map.end ()) {
149- hash_to_graph_map[hash] =
150- DebugUtil::GetTensorsGraphInfo (tensors, indices, format);
149+ std::stringstream ss;
150+ ss << DebugUtil::GetTensorsGraphInfo (tensors, indices, format);
151+ ss << " Graph Hash: " << torch::lazy::HashToString (hash)
152+ << " \n\n ## END_GRAPH\n\n " ;
153+ hash_to_graph_map[hash] = ss.str ();
151154 }
152155}
153156
You can’t perform that action at this time.
0 commit comments