Add Cropping layers support #1309
Open
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.
Description
This PR adds support for Keras' Cropping1D and Cropping2D layers with Vivado and Vitis backend in both
io_parallel
andio_stream
modes.The implementation is straightforward and follows a similar style to zero-padding implementations. I added tests for Vivado and Vitis backends.
I have yet to run this on a board, but implementation was successful targeting a ZCU102, using Vivado 2019.1. Although this type of layer has a fairly niche usage, I still found a use case for it, and it could benefit the community.
Linked Issue: #1308
Type of change
Tests
I added unit tests in
test/pytest/test_cropping.py
Test Configuration:
io_type
:["io_stream", "io_parallel"]
backend
:["Vivado", "Vitis"]
model_type
:["1d", "2d"]
Checklist
pre-commit
on the files I edited or added.