Skip to content

Instantly share code, notes, and snippets.

@rpitonak
Created July 12, 2022 07:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rpitonak/c950f1fcf81e943675ccfc5bb8efa4b3 to your computer and use it in GitHub Desktop.
Save rpitonak/c950f1fcf81e943675ccfc5bb8efa4b3 to your computer and use it in GitHub Desktop.
# Permute dimension, after resize they are in this order
# N W H C
# 0 1 2 3
# After transpose we want them in shape
# N C W H
# 0 3 1 2
perm = onnx.helper.make_node("Constant", inputs=[], outputs=["perm"], name="perm-constant",
value=onnx.helper.make_tensor(name="perm-values",
data_type=onnx.TensorProto.INT64,
dims=np.array([0,3,1,2]).shape,
vals=np.array([0,3,1,2]).flatten()
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment