forked from jiuyuan/InfiniTensor
modified format
This commit is contained in:
parent
9384cec7de
commit
5747eb8f7d
|
@ -1,7 +1,7 @@
|
|||
#include "operators/pad.h"
|
||||
#include "aclnnop/level2/aclnn_reflection_pad2d.h"
|
||||
#include "ascend/ascend_kernel_without_config.h"
|
||||
#include "ascend/ascend_runtime.h"
|
||||
#include "operators/pad.h"
|
||||
|
||||
namespace infini {
|
||||
|
||||
|
@ -12,7 +12,6 @@ class PadAclnn : public ASCENDKernelWithoutConfig {
|
|||
auto op = as<PadObj>(_op);
|
||||
auto context = dynamic_cast<const ASCENDRuntimeObj *>(_context);
|
||||
|
||||
|
||||
void *const aData = (op->getInputs(0)->getRawDataPtr<void *>());
|
||||
void *const cData = (op->getOutput()->getRawDataPtr<void *>());
|
||||
|
||||
|
@ -45,16 +44,16 @@ class PadAclnn : public ASCENDKernelWithoutConfig {
|
|||
|
||||
std::size_t length = intPads.size();
|
||||
std::vector<int64_t> pads(4);
|
||||
if(length == 8){
|
||||
if (length == 8) {
|
||||
std::size_t halfLen = intPads.size() / 2;
|
||||
bool condition = true;
|
||||
//std::cout << "Length of intPads: " << length << std::endl;
|
||||
|
||||
// std::cout << "Length of intPads: " << length << std::endl;
|
||||
|
||||
for (std::size_t i = 0; i < halfLen; ++i) {
|
||||
condition = (intPads[i] == intPads[i + 4]);
|
||||
|
||||
//std::cout << "intPads[" << i << "]: " << intPads[i] << std::endl;
|
||||
// std::cout << "intPads[" << i << "]: " << intPads[i] <<
|
||||
// std::endl;
|
||||
}
|
||||
assert(condition);
|
||||
|
||||
|
@ -62,19 +61,16 @@ class PadAclnn : public ASCENDKernelWithoutConfig {
|
|||
pads[1] = intPads[3];
|
||||
pads[2] = intPads[6];
|
||||
pads[3] = intPads[7];
|
||||
}
|
||||
else if (length == 4){
|
||||
} else if (length == 4) {
|
||||
for (std::size_t i = 0; i < 4; ++i) {
|
||||
|
||||
pads[i] = intPads[i];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
aclIntArray *padding = aclCreateIntArray(pads.data(), 4);
|
||||
auto ret = aclnnReflectionPad2dGetWorkspaceSize(
|
||||
inputTensor, padding , outputTensor,
|
||||
&workspaceSize, &executor);
|
||||
inputTensor, padding, outputTensor, &workspaceSize, &executor);
|
||||
void *workspaceAddr = nullptr;
|
||||
if (workspaceSize > 0) {
|
||||
workspaceAddr = context->getWorkspace(workspaceSize);
|
||||
|
|
Loading…
Reference in New Issue