Pineberry commited on
Commit
f019611
·
verified ·
1 Parent(s): 66bccc6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +35 -2
README.md CHANGED
@@ -23,7 +23,40 @@ pip install tensorflow==2.15.1 tf2onnx==1.16.1
23
  # use most recent opset officially supported
24
  python -m tf2onnx.convert \
25
  --saved-model <path/to/dir> \
26
- --output ds_cnn.onnx --opset 18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  ```
28
 
29
  ## Aidge support
@@ -33,7 +66,7 @@ python -m tf2onnx.convert \
33
  | Feature | Tested in CI |
34
  | :---------: | :----------: |
35
  | ONNX import | ✔️ |
36
- | Backend CPU | |
37
  | Export CPP | ❌ |
38
 
39
 
 
23
  # use most recent opset officially supported
24
  python -m tf2onnx.convert \
25
  --saved-model <path/to/dir> \
26
+ --output converted_ds_cnn.onnx --opset 18
27
+ ```
28
+
29
+ This version input format is NHWC.
30
+ The following Python code fuses MatMul+Add to Gemm and folds the first Reshape operator.
31
+
32
+ ```python
33
+ import onnx
34
+ import onnxruntime
35
+
36
+ import aidge_core as ai
37
+ import aidge_onnx
38
+
39
+ model_onnx = onnx.load_model("converted_ds_cnn.onnx")
40
+ model_onnx_clean_nhwc = aidge_onnx.onnx_cleaner.clean_onnx(
41
+ model_onnx, {"input_1": [[1, 49, 10, 1]]}, "test_clean", opset_version=18
42
+ )
43
+ model = aidge_onnx.convert_onnx_to_aidge(model_onnx_clean_nhwc)
44
+
45
+ # model = aidge_onnx.load_onnx("clean_ds_cnn_inferred.onnx")
46
+
47
+ to_replace: set[ai.Node] = set(
48
+ [
49
+ model.get_node("StatefulPartitionedCall_functional_1_conv2d_BiasAdd__6"),
50
+ model.get_node("new_shape__103_out0"),
51
+ ]
52
+ )
53
+
54
+ model.replace(to_replace, set())
55
+ model.set_mandatory_inputs_first()
56
+
57
+ model.forward_dims(dims=[[1, 1, 49, 10]], allow_data_dependency=True)
58
+ model_onnx_clean_nchw = aidge_onnx.convert_aidge_to_onnx(model, "ds_cnn", opset=18)
59
+ onnx.save_model(model_onnx_clean_nchw, "ds_cnn.onnx")
60
  ```
61
 
62
  ## Aidge support
 
66
  | Feature | Tested in CI |
67
  | :---------: | :----------: |
68
  | ONNX import | ✔️ |
69
+ | Backend CPU | ✔️ |
70
  | Export CPP | ❌ |
71
 
72