File tree Expand file tree Collapse file tree 3 files changed +15
-7
lines changed
src/model_converters/tvm_converter/tvm_auxiliary Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -23,9 +23,11 @@ def _convert_model_from_framework(self):
23
23
24
24
with open (self .model_params , 'rb' ) as f :
25
25
init_net .ParseFromString (f .read ())
26
-
27
- model , params = self .tvm .relay .frontend .from_caffe (init_net ,
26
+ if self . high_level_api in [ 'Relay' , 'RelayVM' ]:
27
+ model , params = self .tvm .relay .frontend .from_caffe (init_net ,
28
28
predict_net ,
29
29
shape_dict ,
30
30
dtype_dict )
31
- return model , params
31
+ return model , params
32
+ else :
33
+ raise ValueError (f'API { self .high_level_api } is not supported' )
Original file line number Diff line number Diff line change @@ -40,5 +40,8 @@ def _get_mxnet_network(self):
40
40
def _convert_model_from_framework (self ):
41
41
net = self ._get_mxnet_network ()
42
42
shape_dict = {self .input_name : self .input_shape }
43
- model , params = self .tvm .relay .frontend .from_mxnet (net , shape_dict )
44
- return model , params
43
+ if self .high_level_api in ['Relay' , 'RelayVM' ]:
44
+ model , params = self .tvm .relay .frontend .from_mxnet (net , shape_dict )
45
+ return model , params
46
+ else :
47
+ raise ValueError (f'API { self .high_level_api } is not supported' )
Original file line number Diff line number Diff line change @@ -20,7 +20,10 @@ def _convert_model_from_framework(self):
20
20
model_tf = self ._get_tf_model (self .model_path )
21
21
shape_dict = {self .input_name : self .input_shape }
22
22
dtype = {self .input_name : 'float32' }
23
- model , params = self .tvm .relay .frontend .from_tflite (model_tf ,
23
+ if self .high_level_api in ['Relay' , 'RelayVM' ]:
24
+ model , params = self .tvm .relay .frontend .from_tflite (model_tf ,
24
25
shape_dict = shape_dict ,
25
26
dtype_dict = dtype )
26
- return model , params
27
+ return model , params
28
+ else :
29
+ raise ValueError (f'API { self .high_level_api } is not supported' )
You can’t perform that action at this time.
0 commit comments