File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright 2019-present, Laurent Mazare.
2
+ // Copyright 2019-present Guillaume Becquin
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ // Unless required by applicable law or agreed to in writing, software
8
+ // distributed under the License is distributed on an "AS IS" BASIS,
9
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ // See the License for the specific language governing permissions and
11
+ // limitations under the License.
12
+
13
+ use failure:: ensure;
14
+
15
+ pub fn main ( ) -> failure:: Fallible < ( ) > {
16
+ let args: Vec < _ > = std:: env:: args ( ) . collect ( ) ;
17
+ ensure ! (
18
+ args. len( ) == 3 ,
19
+ "usage: {} source.npz destination.ot" ,
20
+ args[ 0 ]
21
+ ) ;
22
+
23
+ let source_file = & args[ 1 ] ;
24
+ let destination_file = & args[ 2 ] ;
25
+ let tensors = tch:: Tensor :: read_npz ( source_file) ?;
26
+ tch:: Tensor :: save_multi ( & tensors, destination_file) ?;
27
+
28
+ Ok ( ( ) )
29
+ }
You can’t perform that action at this time.
0 commit comments