File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -495,16 +495,12 @@ impl SavedModelSaver {
495
495
) -> std:: result:: Result < ( ) , SaveModelError > {
496
496
let mut meta_graph = self . meta_graph . clone ( ) ;
497
497
let graph_bytes = graph. graph_def ( ) ?;
498
- let graph_def = match protobuf:: Message :: parse_from_bytes ( & graph_bytes) {
499
- Ok ( x) => x,
500
- Err ( e) => {
501
- return Err ( Status :: new_set_lossy (
502
- Code :: InvalidArgument ,
503
- & format ! ( "Unable to parse graph definition: {}" , e) ,
504
- )
505
- . into ( ) ) ;
506
- }
507
- } ;
498
+ let graph_def = protobuf:: Message :: parse_from_bytes ( & graph_bytes) . map_err ( |e| {
499
+ SaveModelError :: from ( Status :: new_set_lossy (
500
+ Code :: InvalidArgument ,
501
+ & format ! ( "Unable to parse graph definition: {}" , e) ,
502
+ ) )
503
+ } ) ?;
508
504
meta_graph. set_graph_def ( graph_def) ;
509
505
let mut saved_model = protos:: saved_model:: SavedModel :: new ( ) ;
510
506
saved_model. set_saved_model_schema_version ( 1 ) ;
You can’t perform that action at this time.
0 commit comments