-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Refactors onnx import adding better support for image functions #9466
Merged
Merged
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
b8fb66b
Refactors onnx import adding better support for image functions
agibsonccc 865cb81
Fix up import hooks, fix image resize enums, add small additional val…
agibsonccc 4a5bbc2
Add unsqueeze op, upgrade op version to 13 for onnxruntime runner, mo…
agibsonccc d5ee31d
Add beginnings of Slice support
agibsonccc 34b544f
Minor fixes for slice call, conditions
agibsonccc e168433
Fix up strided slice invocation
agibsonccc 497a909
Remove debugging
agibsonccc cd4b919
Initial add for where, expand, minor op declration clean up
agibsonccc 93345cd
Add expand test, create function to code gen
agibsonccc b16f43e
Update TestOnnxIR.kt
agibsonccc 1b6e8b2
Remove temp files
agibsonccc 7a9c510
Merge branch 'master' into ag_onnx_resize
agibsonccc File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -241,7 +241,7 @@ fun SDImage() = Namespace("Image"){ | |
Arg(BOOL, "preserveAspectRatio") { description = "Whether to preserve the aspect ratio." + | ||
" If this is set, then images will be resized to a size that fits in size while preserving the aspect ratio" + | ||
" of the original image. Scales up the image if size is bigger than the current size of the image. Defaults to False."; defaultValue=false; } | ||
Arg(BOOL, "antialis") { description = "Whether to use an anti-aliasing filter when downsampling an image"; defaultValue=false; } | ||
Arg(BOOL, "antialias") { description = "Whether to use an anti-aliasing filter when downsampling an image"; defaultValue=false; } | ||
Arg(ENUM, "ImageResizeMethod") { possibleValues = listOf( "ResizeBilinear", "ResizeBicubic", "ResizeNearest", "ResizeGaussian", | ||
"ResizeLanczos5", "ResizeMitchelcubic", "ResizeArea"); description = "ResizeBilinear: Bilinear interpolation. If 'antialias' is true, becomes a hat/tent filter function with radius 1 when downsampling.\n" + | ||
"ResizeLanczos5: Lanczos kernel with radius 5. Very-high-quality filter but may have stronger ringing.\n" + | ||
|
@@ -259,4 +259,36 @@ fun SDImage() = Namespace("Image"){ | |
""".trimIndent() | ||
} | ||
} | ||
|
||
Op("resizeBiLinear") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @treo new op for bi linear image resize. |
||
javaPackage = "org.nd4j.linalg.api.ops.impl.image" | ||
javaOpClass = "ResizeBilinear" | ||
Input(NUMERIC,"input") { description = "4D image"} | ||
Arg(INT ,"height") { description = "target height for resizing to "} | ||
Arg(INT ,"width") { description = "target width for resizing to"} | ||
Arg(BOOL ,"alignCorners") { description = "whether to align corners during resizing. Images are aligned to preserve corners."} | ||
Arg(BOOL,"halfPixelCenters") { description = "When resizing, assumes pixels are centered at 0.5."} | ||
Output(NUMERIC, "output"){ description = "Output image" } | ||
Doc(Language.ANY, DocScope.ALL){ | ||
""" | ||
Resize images to size using the specified method. | ||
""".trimIndent() | ||
} | ||
} | ||
|
||
Op("resizeBiCubic") { | ||
javaPackage = "org.nd4j.linalg.api.ops.impl.image" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @treo same for bicubic |
||
javaOpClass = "ResizeBicubic" | ||
Input(NUMERIC,"input") { description = "4D image"} | ||
Input(INT ,"size") { description = "the target size to resize to "} | ||
Arg(BOOL ,"alignCorners") { description = "whether to align corners during resizing. Images are aligned to preserve corners."} | ||
Arg(BOOL,"alignPixelCenters") { description = "When resizing, assumes pixels are centered at 0.5."} | ||
Output(NUMERIC, "output"){ description = "Output image" } | ||
Doc(Language.ANY, DocScope.ALL){ | ||
""" | ||
Resize images to size using the specified method. | ||
""".trimIndent() | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...rg/nd4j/samediff/frameworkimport/onnx/definitions/implementations/GlobalAveragePooling.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...in/org/nd4j/samediff/frameworkimport/onnx/definitions/implementations/GlobalMaxPooling.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@treo typo fix