mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-29 20:14:01 +00:00
Minor change to improve performance for operator Pad. (#5537)
* small improvment for pad
This commit is contained in:
parent
7ccdfed1a6
commit
8a0f5c50ab
1 changed files with 12 additions and 2 deletions
|
|
@ -97,8 +97,18 @@ static void PadInnermostAxis(T* output, T* input, ptrdiff_t input_delta, size_t
|
|||
// For constant padding, there is no input, just a size to write the constant to
|
||||
template <typename T>
|
||||
static void PadAxisConstant(T* output, T constant, size_t size) {
|
||||
for (size_t i = 0; i < size; i++)
|
||||
*output++ = constant;
|
||||
if (size == 1) {
|
||||
*output = constant;
|
||||
} else if (size == 2) {
|
||||
*output = constant;
|
||||
*(output + 1) = constant;
|
||||
} else {
|
||||
// This would be faster with SSE instructions.
|
||||
// That would mean to have an implementation for each type (uint8, uint32, uint64).
|
||||
T* end = output + size;
|
||||
for (; output != end;)
|
||||
*output++ = constant;
|
||||
}
|
||||
}
|
||||
|
||||
Status PadBase::HandleDimValueZero(const Mode& mode, const TensorShape& input_shape, TensorShape& output_shape) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue