File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -492,15 +492,16 @@ def build_toco_convert_protos(input_tensors,
492492 else :
493493 shape = input_shapes [idx ]
494494
495- # Create shapes with -1 for unknown dimensions.
496- dims = []
497- for dim in shape :
498- if (dim is None or
499- (isinstance (dim , tensor_shape .Dimension ) and dim .value is None )):
500- dims .append (- 1 )
501- else :
502- dims .append (int (dim ))
503- input_array .shape .dims .extend (dims )
495+ if shape .rank is not None :
496+ # Create shapes with -1 for unknown dimensions.
497+ dims = []
498+ for dim in shape :
499+ if (dim is None or
500+ (isinstance (dim , tensor_shape .Dimension ) and dim .value is None )):
501+ dims .append (- 1 )
502+ else :
503+ dims .append (int (dim ))
504+ input_array .shape .dims .extend (dims )
504505
505506 for output_tensor in output_tensors :
506507 if saved_model_dir :
You can’t perform that action at this time.
0 commit comments