Sam4onnx

Latest version: v1.0.14

Safety actively analyzes 621920 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 3

1.0.14

- Support for recursive search of subgraphs of `If` OP.
- Enhanced functionality to allow parameter rewriting even when the OP to be rewritten is in a hierarchy of multi-level subgraphs.
- main graph
![image](https://user-images.githubusercontent.com/33194443/235596381-b0b33548-6718-4f87-b3ee-3353bd966354.png)
- sub graph.1
![image](https://user-images.githubusercontent.com/33194443/235596582-adc8695d-58ba-4196-aeb0-a99b2e97c942.png)
- sub graph.2
![image](https://user-images.githubusercontent.com/33194443/235596737-fa7b5e1f-769c-4798-bc44-031bf366867a.png)

What's Changed
* Support for recursive search of subgraphs of `If` OP. by PINTO0309 in https://github.com/PINTO0309/sam4onnx/pull/4


**Full Changelog**: https://github.com/PINTO0309/sam4onnx/compare/1.0.13...1.0.14

1.0.13

- Support for rewriting the output shape of operations

-os OUTPUT_SHAPES OUTPUT_SHAPES, --output_shapes OUTPUT_SHAPES OUTPUT_SHAPES
Specifies the name of the output to be changed. output_shapes can be specified multiple times.
--output_shapes output_name1 shape1
--output_shapes output_name2 shape2

e.g.
--output_shapes output_name1 [1]
--output_shapes output_name2 [1,3,224,224]


What's Changed
* Support for rewriting the output shape of operations by PINTO0309 in https://github.com/PINTO0309/sam4onnx/pull/3


**Full Changelog**: https://github.com/PINTO0309/sam4onnx/compare/1.0.12...1.0.13

1.0.12

What's Changed
* Support for models with custom domains by PINTO0309 in https://github.com/PINTO0309/sam4onnx/pull/2

New Contributors
* PINTO0309 made their first contribution in https://github.com/PINTO0309/sam4onnx/pull/2

**Full Changelog**: https://github.com/PINTO0309/sam4onnx/compare/1.0.11...1.0.12

1.0.11

- Add short form parameter

$ sam4onnx -h

usage:
sam4onnx [-h]
-if INPUT_ONNX_FILE_PATH
-of OUTPUT_ONNX_FILE_PATH
[-on OP_NAME]
[-a NAME DTYPE VALUE]
[-da DELETE_ATTRIBUTES [DELETE_ATTRIBUTES ...]]
[-ic NAME DTYPE VALUE]
[-n]

optional arguments:
-h, --help
show this help message and exit

-if INPUT_ONNX_FILE_PATH, --input_onnx_file_path INPUT_ONNX_FILE_PATH
Input onnx file path.

-of OUTPUT_ONNX_FILE_PATH, --output_onnx_file_path OUTPUT_ONNX_FILE_PATH
Output onnx file path.

-on OP_NAME, --op_name OP_NAME
OP name of the attributes to be changed.
When --attributes is specified, --op_name must always be specified.
e.g. --op_name aaa

-a ATTRIBUTES ATTRIBUTES ATTRIBUTES, --attributes ATTRIBUTES ATTRIBUTES ATTRIBUTES
Parameter to change the attribute of the OP specified in --op_name.
If the OP specified in --op_name has no attributes,
it is ignored. attributes can be specified multiple times.
--attributes name dtype value dtype is one of
"float32" or "float64" or "int32" or "int64" or "str".
https://github.com/onnx/onnx/blob/main/docs/Operators.md

e.g.
--attributes alpha float32 [[1.0]]
--attributes beta float32 [1.0]
--attributes transA int64 0
--attributes transB int64 0

-da DELETE_ATTRIBUTES [DELETE_ATTRIBUTES ...], --delete_attributes DELETE_ATTRIBUTES [DELETE_ATTRIBUTES ...]
Parameter to delete the attribute of the OP specified in --op_name.
If the OP specified in --op_name has no attributes,
it is ignored. delete_attributes can be specified multiple times.
--delete_attributes name1 name2 name3
https://github.com/onnx/onnx/blob/main/docs/Operators.md

e.g. --delete_attributes alpha beta

-ic INPUT_CONSTANTS INPUT_CONSTANTS INPUT_CONSTANTS, --input_constants INPUT_CONSTANTS INPUT_CONSTANTS INPUT_CONSTANTS
Specifies the name of the constant to be changed.
If you want to change only the constant,
you do not need to specify --op_name and --attributes.
input_constants can be specified multiple times.
--input_constants constant_name numpy.dtype value

e.g.
--input_constants constant_name1 int64 0
--input_constants constant_name2 float32 [[1.0,2.0,3.0],[4.0,5.0,6.0]]
--input_constants constant_name3 float32 [\'-Infinity\']

-n, --non_verbose
Do not show all information logs. Only error logs are displayed.

1.0.10

- Supports the specification of `-np.inf`, `-np.inf`, `"Infinity"`, and `"-Infinity"`
![image](https://user-images.githubusercontent.com/33194443/183275681-4aa47989-03bf-4334-a956-b0c827093ddc.png)

1.0.9

- Support for constant rewriting when the same constant is shared. Valid only when `op_name` is specified. Generates a new constant that is different from the shared constant.

- `Reshape_156 onnx::Reshape_391 int64 [1, -1, 85]`
![image](https://user-images.githubusercontent.com/33194443/179403146-c0cc9881-29c2-485d-904a-31b976cd7ac2.png)
- `Reshape_174 onnx::Reshape_391 int64 [1, -1, 85]`
![image](https://user-images.githubusercontent.com/33194443/179403184-9f3cbf0e-582a-4e58-81a8-7ae4cbb140c2.png)
bash
sam4onnx \
--input_onnx_file_path yolov7-tiny_test_sim.onnx \
--output_onnx_file_path yolov7-tiny_test_sim_mod.onnx \
--op_name Reshape_156 \
--input_constants onnx::Reshape_391 int64 [1,14400,85]

- `Reshape_156 onnx::Reshape_391 int64 [1, -1, 85]` -> `Reshape_156 onnx::Reshape_391_mod_3 int64 [1, 14400, 85]`
![image](https://user-images.githubusercontent.com/33194443/179403335-0137bcb4-5186-426f-8afe-ab0feef73e30.png)
- `Reshape_174 onnx::Reshape_391 int64 [1, -1, 85]`
![image](https://user-images.githubusercontent.com/33194443/179403354-e6fbd739-87ed-4b3b-9b7d-1ebf42414c34.png)

Page 1 of 3

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.