-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: YdrMaster <ydrml@hotmail.com>
- Loading branch information
Showing
5 changed files
with
126 additions
and
27 deletions.
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include "pad_2d_info.h" | ||
#include <numeric> | ||
|
||
namespace refactor::kernel { | ||
|
||
Pad2DInfo::Pad2DInfo(DataType dt, slice_t<dim_t> input, ddim_t const *pads) | ||
: blockCount(std::accumulate(input.begin(), input.end() - 2, 1, std::multiplies<>())), | ||
blockSize(dt.size()), | ||
hw(input.end()[-1] * input.end()[-2]), | ||
w(input.end()[-1]), | ||
padHW(pads[0] - pads[2]), | ||
padW(pads[1] - pads[3]) {} | ||
|
||
}// namespace refactor::kernel |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#ifndef KERNEL_PAD_2D_INFO_H | ||
#define KERNEL_PAD_2D_INFO_H | ||
|
||
#include "kernel/tensor.h" | ||
|
||
namespace refactor::kernel { | ||
/// @brief 优化用于计算的 Slice 描述。 | ||
struct Pad2DInfo { | ||
dim_t blockCount, blockSize, hw, w; | ||
ddim_t padHW, padW; | ||
|
||
Pad2DInfo(DataType, slice_t<dim_t> input, ddim_t const *pads); | ||
}; | ||
|
||
}// namespace refactor::kernel | ||
|
||
#endif// KERNEL_PAD_2D_INFO_H |
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