-
Notifications
You must be signed in to change notification settings - Fork 622
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
Add sequence and 3D support in flip operator #1439
Conversation
!build |
CI MESSAGE: [974591]: BUILD STARTED |
CI MESSAGE: [974591]: BUILD FAILED |
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
ec0bc1d
to
2e69ec6
Compare
!build |
CI MESSAGE: [974619]: BUILD STARTED |
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
CI MESSAGE: [974691]: BUILD STARTED |
CI MESSAGE: [974619]: BUILD FAILED |
CI MESSAGE: [974691]: BUILD PASSED |
dali/kernels/imgproc/flip_cpu.h
Outdated
@@ -90,18 +99,19 @@ class DLL_PUBLIC FlipCPU { | |||
public: | |||
DLL_PUBLIC FlipCPU() = default; | |||
|
|||
DLL_PUBLIC KernelRequirements Setup(KernelContext &context, const InTensorCPU<Type, 4> &in) { | |||
DLL_PUBLIC KernelRequirements Setup(KernelContext &context, const InTensorCPU<Type, 5> &in) { |
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.
Can you put some meaningful name to this magic 5?
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.
Done
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
@@ -23,6 +23,9 @@ | |||
|
|||
namespace dali { | |||
namespace kernels { | |||
|
|||
constexpr int sample_ndim = 5; |
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.
can you use this in all the places where there is a 5 hardcoded?
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.
done
dali/kernels/imgproc/flip_cpu.h
Outdated
detail::cpu::FlipImpl(out_data, in_data, in.shape[0], in.shape[1], in.shape[2], in.shape[3], | ||
flip_z, flip_y, flip_x); | ||
detail::cpu::FlipImpl(out_data, in_data, | ||
in.shape[0], in.shape[1], in.shape[2], in.shape[3], in.shape[4], |
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.
why not just pass in.shape
?
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.
Good point, done
@@ -24,7 +24,7 @@ namespace dali { | |||
namespace kernels { | |||
|
|||
class FlipCpuTest | |||
: public::testing::TestWithParam<std::tuple<int, int, int, std::array<Index, 4>>> { | |||
: public::testing::TestWithParam<std::tuple<int, int, int, std::array<Index, 5>>> { |
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.
use sample_ndim
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.
done
}; | ||
|
||
TEST_P(FlipCpuTest, ImplTest) { | ||
std::vector<float> out_data(volume(shape_)); | ||
detail::cpu::FlipImpl( | ||
out_data.data(), in_view_.data, | ||
shape_[0], shape_[1], shape_[2], shape_[3], | ||
shape_[0], shape_[1], shape_[2], shape_[3], shape_[4], |
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.
I am wondering, is it possible to work with a shape or arbitrary size and a layout, so that we can get the relevant dimensions and set to 1 the rest of them (that is, inside the implementation)
@@ -23,7 +23,7 @@ | |||
namespace dali { | |||
namespace kernels { | |||
|
|||
class FlipGpuTest: public testing::TestWithParam<std::array<Index, 4>> { | |||
class FlipGpuTest: public testing::TestWithParam<std::array<Index, 5>> { |
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.
sample_ndim
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.
done
@@ -36,7 +39,7 @@ inline int GetOcvType(size_t channels) { | |||
|
|||
template <typename Type> | |||
void OcvFlip(Type *output, const Type *input, | |||
size_t layers, size_t height, size_t width, size_t channels, | |||
size_t depth, size_t height, size_t width, size_t channels, |
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.
Why? And what about frames?
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.
Why?
depth
seems a better name along with height and width.
What about frames?
Do we want to flip the order of frames?
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
!build |
CI MESSAGE: [988584]: BUILD STARTED |
CI MESSAGE: [988584]: BUILD PASSED |
Signed-off-by: Rafal Banas.Rafal97@gmail.com
Why we need this PR?
It extends the flip operator to support volumetric inputs and sequences.
What happened in this PR?
The kernel tests were extended and python tests for sequences and volumetric inputs were added
N. A.
JIRA TASK: [DALI-865]