def process_attr(attr_str: str): processed = getattr(attr, ONNX_PYTHON_ATTR_MAPPING[attr_str]) if attr_str == "STRING": processed = processed.decode() elif attr_str == "TENSOR": processed = OnnxImporter.import_tensor(processed) elif attr_str == "GRAPH": processed = OnnxImporter.import_graph(processed, misc.combine_dicts(tensor_map, subgraph_tensor_map)) elif attr_str == "FLOATS" or attr_str == "INTS": processed = list(processed) elif attr_str == "STRINGS": processed = [p.decode() for p in processed] return processed
def test_combine_dicts_second_overwrites_first(): x = {"a": 1} y = {"a": 2} z = misc.combine_dicts(x, y) assert z["a"] == 2