You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

onnx_clip_v9.py 946 B

3 years ago
1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/env python3
  2. # -*- coding utf-8 -*-
  3. # Copyright Huawei Technologies Co., Ltd 2019-2022. All rights reserved.
  4. import onnx
  5. from onnx import helper
  6. from onnx import AttributeProto, TensorProto, GraphProto
  7. def make_clip_V9():
  8. X = helper.make_tensor_value_info("X", TensorProto.FLOAT, [3, 4, 5])
  9. Y = helper.make_tensor_value_info("Y", TensorProto.FLOAT, [3, 4, 5])
  10. node_def = helper.make_node('Clip',
  11. inputs=['X'],
  12. outputs=['Y'],
  13. max = 1.0,
  14. min = -1.0,
  15. )
  16. graph = helper.make_graph(
  17. [node_def],
  18. "test_clip_case_V9",
  19. [X],
  20. [Y],
  21. )
  22. model = helper.make_model(graph, producer_name="onnx-mul_test")
  23. model.opset_import[0].version = 9
  24. onnx.save(model, "./onnx_clip_v9.onnx")
  25. if __name__ == '__main__':
  26. make_clip_V9()