-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove unused jinja
templates
#199
Conversation
Signed-off-by: neNasko1 <[email protected]>
Signed-off-by: neNasko1 <[email protected]>
@@ -1,33 +0,0 @@ | |||
def xloop( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like xloop
was made private at some point and then removed. Let's let @jbachurski or @cbourjau weigh in briefly for some historical context first, but to my eye this looks perfectly reasonable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t remember this very well, so it may have been an attempt to make the API more convenient. It’s probably fine to remove since it’s unused.
### Description This change: - Introduces attribute checking for `CategoryMapper` - Includes tests for `CategoryMapper` in the case of wrong attributes - Includes tests for `OneHotEncoder` in the case of wrong attributes - Fix the tests around `TreeEnsemble` ### Motivation and Context There is some similar functionality currently in [spox](https://github.com/Quantco/spox), ([related](Quantco/spox#199)), which will be better lived here. Note: The fix around the `TreeEnsemble` tests is related to the fact that the test parametrization was wrongly implemented. Relevant [documentation](https://pypi.org/project/parameterized/). ``` > xxx(10180)test_tree_ensemble_fails_if_invalid_attributes() -> breakpoint() (Pdb) ll 10133 @parameterized.expand( 10134 [ 10135 { 10136 "nodes_truenodeids": [0] * 6, 10137 "leaf_weights": make_tensor( 10138 "leaf_weights", TensorProto.DOUBLE, (9,), [1] * 9 10139 ), 10140 "nodes_splits": make_tensor( 10141 "nodes_splits", TensorProto.DOUBLE, (5,), [1] * 5 10142 ), 10143 }, 10144 { 10145 "nodes_truenodeids": [0] * 5, 10146 "leaf_weights": make_tensor( 10147 "leaf_weights", TensorProto.FLOAT, (9,), [1] * 9 10148 ), 10149 "nodes_splits": make_tensor( 10150 "nodes_splits", TensorProto.DOUBLE, (5,), [1] * 5 10151 ), 10152 }, 10153 { 10154 "nodes_truenodeids": [0] * 5, 10155 "leaf_weights": make_tensor( 10156 "leaf_weights", TensorProto.DOUBLE, (18,), [1] * 18 10157 ), 10158 "nodes_splits": make_tensor( 10159 "nodes_splits", TensorProto.DOUBLE, (5,), [1] * 5 10160 ), 10161 }, 10162 { 10163 "nodes_truenodeids": [0] * 5, 10164 "leaf_weights": make_tensor( 10165 "leaf_weights", TensorProto.DOUBLE, (9,), [1] * 9 10166 ), 10167 "nodes_splits": make_tensor( 10168 "nodes_splits", TensorProto.FLOAT, (5,), [1] * 5 10169 ), 10170 }, 10171 ] 10172 ) 10173 @unittest.skipUnless(ONNX_ML, "ONNX_ML required to test ai.onnx.ml operators") 10174 def test_tree_ensemble_fails_if_invalid_attributes( 10175 self, 10176 nodes_truenodeids, 10177 leaf_weights, 10178 nodes_splits, 10179 ) -> None: 10180 -> breakpoint() 10181 interior_nodes = 5 10182 leaves = 9 10183 tree = make_node( 10184 "TreeEnsemble", 10185 ["x"], 10186 ["y"], 10187 domain=ONNX_ML_DOMAIN, 10188 n_targets=5, 10189 nodes_featureids=[0] * interior_nodes, 10190 nodes_splits=nodes_splits, 10191 nodes_modes=make_tensor( 10192 "nodes_modes", 10193 TensorProto.UINT8, 10194 (interior_nodes,), 10195 [0] * interior_nodes, 10196 ), 10197 nodes_truenodeids=nodes_truenodeids, 10198 nodes_falsenodeids=[0] * interior_nodes, 10199 nodes_trueleafs=[0] * interior_nodes, 10200 nodes_falseleafs=[0] * interior_nodes, 10201 leaf_targetids=[0] * leaves, 10202 leaf_weights=leaf_weights, 10203 tree_roots=[0], 10204 ) 10205 10206 graph = self._make_graph( 10207 [("x", TensorProto.DOUBLE, ("Batch Size", "Features"))], 10208 [tree], 10209 [], 10210 ) 10211 self.assertRaises(onnx.shape_inference.InferenceError, self._inferred, graph) (Pdb) nodes_truenodeids 'nodes_truenodeids' (Pdb) leaf_weights 'leaf_weights' (Pdb) nodes_splits 'nodes_splits' (Pdb) ``` --------- Signed-off-by: neNasko1 <[email protected]>
Signed-off-by: Atanas Dimitrov <[email protected]>
This PR removes some of the old/unused
jinja
templates.Also based on the following upstreamed changes we can safely remove some of the custom type propagation subroutines:
Since we do some extra checking around the following operators, I am asking for input whether to include them in this PR.
EDIT: We decided to wait for those 3 operators until some later
onnx
release.Checklist
CHANGELOG.rst
entry