Skip to content

Commit 8428be7

Browse files
committed
simplify two tests'
Signed-off-by: xadupre <[email protected]>
1 parent c806726 commit 8428be7

File tree

2 files changed

+11
-63
lines changed

2 files changed

+11
-63
lines changed

.github/workflows/keras_application_test_ci.yml

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,6 @@ concurrency:
1515

1616
jobs:
1717

18-
Test1_py38_tf2_9: # Do not change this name because it is used in Ruleset of this repo.
19-
strategy:
20-
fail-fast: false
21-
runs-on: ubuntu-latest
22-
23-
steps:
24-
- name: Checkout code
25-
uses: actions/checkout@v4
26-
27-
- name: Run Tests (Py39-TF2.9)
28-
uses: ./.github/actions/keras_application_test
29-
with:
30-
tf_version: '2.9.0'
31-
python_version: '3.9'
32-
ort_version: '1.16.3'
33-
onnx_version: '1.16.1'
34-
35-
- name: Upload Test Results
36-
if: always()
37-
uses: actions/upload-artifact@v4
38-
with:
39-
name: Test Results (Py39-TF2.9-ubuntu)
40-
path: ./**/test-results-*.xml
41-
4218
Test1_py310_tf2_19: # Do not change this name because it is used in Ruleset of this repo.
4319
strategy:
4420
fail-fast: false
@@ -63,30 +39,6 @@ jobs:
6339
name: Test Results (Py310-TF2.19-ubuntu)
6440
path: ./**/test-results-*.xml
6541

66-
Test1_py37_with_tf1_15: # Do not change this name because it is used in Ruleset of this repo.
67-
strategy:
68-
fail-fast: false
69-
runs-on: ubuntu-22.04
70-
71-
steps:
72-
- name: Checkout code
73-
uses: actions/checkout@v4
74-
75-
- name: Run Tests (Py37-TF1.15)
76-
uses: ./.github/actions/keras_application_test
77-
with:
78-
tf_version: '1.15.5'
79-
python_version: '3.7'
80-
ort_version: '1.14.1'
81-
onnx_version: '1.14.1'
82-
83-
- name: Upload Test Results
84-
if: always()
85-
uses: actions/upload-artifact@v4
86-
with:
87-
name: Test Results (Py37-TF1.15-ubuntu)
88-
path: ./**/test-results-*.xml
89-
9042
Extra_tests1:
9143
strategy:
9244
fail-fast: false
@@ -140,7 +92,7 @@ jobs:
14092

14193
publish-test-results:
14294
name: "Publish Tests Results to Github"
143-
needs: [Test1_py38_tf2_9, Test1_py310_tf2_19, Test1_py37_with_tf1_15, Extra_tests1]
95+
needs: [Test1_py310_tf2_19, Extra_tests1]
14496
runs-on: ubuntu-latest
14597
permissions:
14698
checks: write

tests/keras2onnx_unit_tests/test_subclassing.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,6 @@ def get_save_spec(model, dynamic_batch=False):
8686
return specs
8787

8888

89-
class SimpleWrapperModel(tf.keras.Model):
90-
def __init__(self, func):
91-
super(SimpleWrapperModel, self).__init__()
92-
self.func = func
93-
94-
def call(self, inputs, **kwargs):
95-
return self.func(inputs)
96-
97-
def _get_save_spec(self, dynamic_batch=False):
98-
return get_save_spec(self, dynamic_batch=dynamic_batch)
99-
100-
10189
def test_lenet(runner):
10290
tf.keras.backend.clear_session()
10391
lenet = LeNet()
@@ -127,7 +115,11 @@ def op_func(arg_inputs):
127115
x = x - tf.cast(tf.expand_dims(r, axis=0), tf.float32)
128116
return x
129117

130-
dm = SimpleWrapperModel(op_func)
118+
class Model(tf.keras.Model):
119+
def call(self, inputs, **kwargs):
120+
return op_func(inputs)
121+
122+
dm = Model()
131123
inputs = [tf.random.normal((3, 2, 20)), tf.random.normal((3, 2, 20))]
132124
expected = dm.predict(inputs)
133125
oxml = convert_keras(dm)
@@ -235,7 +227,11 @@ def _tf_where(input_0):
235227
c = tf.logical_or(tf.cast(a, tf.bool), tf.cast(b, tf.bool))
236228
return c
237229

238-
swm = SimpleWrapperModel(_tf_where)
230+
class Model(tf.keras.Model):
231+
def call(self, inputs, **kwargs):
232+
return _tf_where(inputs)
233+
234+
swm = Model()
239235
const_in = [np.array([2, 4, 6, 8, 10]).astype(np.int32)]
240236
expected = swm(const_in)
241237
if hasattr(swm, "_set_input"):

0 commit comments

Comments
 (0)