Skip to content

Commit 6071912

Browse files
authored
add script to delete unused dimension
1 parent 649199c commit 6071912

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

print.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
import coremltools
3+
import coremltools.proto.FeatureTypes_pb2 as ft
4+
5+
spec = coremltools.utils.load_spec("FaceEmotionAddPreprocessArgs.mlmodel")
6+
output = spec.description.output[0]
7+
input = spec.description.input[0]
8+
#delete the first dimension of size 1 to let the coreml know what it is
9+
10+
del output.type.multiArrayType.shape[0]
11+
12+
del input.type.multiArrayType.shape[0]
13+
14+
print(spec.description)
15+
# delete the output of first dimension of size1 to let the CoreML know what it is
16+
print(input)
17+
18+
#del output.type.multiArrayType.shape[0]
19+
print(spec.description)
20+
21+
22+
coremltools.utils.save_spec(spec,"FaceEmotionAddPreprocessArgs.mlmodel")

0 commit comments

Comments
 (0)