Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ngraph_creator/operations/include/DepthToSpace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace nnhal {
class DepthToSpace : public OperationsBase {
public:
DepthToSpace(int operationIndex);
bool validate() override;
std::shared_ptr<ngraph::Node> createNode() override;
};

Expand Down
1 change: 0 additions & 1 deletion ngraph_creator/operations/include/Dequantize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class Dequantize : public OperationsBase {
public:
Dequantize(int operationIndex);
std::shared_ptr<ngraph::Node> createNode() override;
bool validate() override;
};

} // namespace nnhal
Expand Down
1 change: 0 additions & 1 deletion ngraph_creator/operations/include/Div.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace nnhal {
class Div : public OperationsBase {
public:
Div(int operationIndex);
bool validate() override;
std::shared_ptr<ngraph::Node> createNode() override;
};

Expand Down
1 change: 0 additions & 1 deletion ngraph_creator/operations/include/L2Pooling2D.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace nnhal {
class L2Pooling2D : public OperationsBase {
public:
L2Pooling2D(int operationIndex);
bool validate() override;
std::shared_ptr<ngraph::Node> createNode() override;
};

Expand Down
1 change: 0 additions & 1 deletion ngraph_creator/operations/include/Less.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace nnhal {
class Less : public OperationsBase {
public:
Less(int operationIndex);
bool validate() override;
std::shared_ptr<ngraph::Node> createNode() override;
};

Expand Down
1 change: 0 additions & 1 deletion ngraph_creator/operations/include/Logistic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace nnhal {
class Logistic : public OperationsBase {
public:
Logistic(int operationIndex);
bool validate() override;
std::shared_ptr<ngraph::Node> createNode() override;
};

Expand Down
1 change: 0 additions & 1 deletion ngraph_creator/operations/include/MaxPool2d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace nnhal {
class MaxPool2d : public OperationsBase {
public:
MaxPool2d(int operationIndex);
bool validate() override;
std::shared_ptr<ngraph::Node> createNode() override;
};

Expand Down
1 change: 0 additions & 1 deletion ngraph_creator/operations/include/Mul.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace nnhal {
class Mul : public OperationsBase {
public:
Mul(int operationIndex);
bool validate() override;
std::shared_ptr<ngraph::Node> createNode() override;
};

Expand Down
1 change: 0 additions & 1 deletion ngraph_creator/operations/include/Quantize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class Quantize : public OperationsBase {
public:
Quantize(int operationIndex);
std::shared_ptr<ngraph::Node> createNode() override;
bool validate() override;
void connectOperationToGraph() override;
};

Expand Down
1 change: 0 additions & 1 deletion ngraph_creator/operations/include/ReduceMin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace nnhal {
class ReduceMin : public OperationsBase {
public:
ReduceMin(int operationIndex);
bool validate() override;
std::shared_ptr<ngraph::Node> createNode() override;
};

Expand Down
1 change: 0 additions & 1 deletion ngraph_creator/operations/include/ReduceSum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace nnhal {
class ReduceSum : public OperationsBase {
public:
ReduceSum(int operationIndex);
bool validate() override;
std::shared_ptr<ngraph::Node> createNode() override;
};

Expand Down
1 change: 0 additions & 1 deletion ngraph_creator/operations/include/Relu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace nnhal {
class Relu : public OperationsBase {
public:
Relu(int operationIndex);
bool validate() override;
std::shared_ptr<ngraph::Node> createNode() override;
};

Expand Down
1 change: 0 additions & 1 deletion ngraph_creator/operations/include/Relu1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace nnhal {
class Relu1 : public OperationsBase {
public:
Relu1(int operationIndex);
bool validate() override;
std::shared_ptr<ngraph::Node> createNode() override;
};

Expand Down
1 change: 0 additions & 1 deletion ngraph_creator/operations/include/Relu6.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace nnhal {
class Relu6 : public OperationsBase {
public:
Relu6(int operationIndex);
bool validate() override;
std::shared_ptr<ngraph::Node> createNode() override;
};

Expand Down
1 change: 0 additions & 1 deletion ngraph_creator/operations/include/Softmax.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace nnhal {
class Softmax : public OperationsBase {
public:
Softmax(int operationIndex);
bool validate() override;
std::shared_ptr<ngraph::Node> createNode() override;
};

Expand Down
1 change: 0 additions & 1 deletion ngraph_creator/operations/include/Sub.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace nnhal {
class Sub : public OperationsBase {
public:
Sub(int operationIndex);
bool validate() override;
std::shared_ptr<ngraph::Node> createNode() override;
};

Expand Down
1 change: 0 additions & 1 deletion ngraph_creator/operations/include/Tanh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace nnhal {
class Tanh : public OperationsBase {
public:
Tanh(int operationIndex);
bool validate() override;
std::shared_ptr<ngraph::Node> createNode() override;
};

Expand Down
25 changes: 5 additions & 20 deletions ngraph_creator/operations/src/Add.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,14 @@ Add::Add(int operationIndex) : OperationsBase(operationIndex) {
}

bool Add::validate() {
auto operandIndex1 = sModelInfo->getOperationInput(mNnapiOperationIndex, 0);
auto operandIndex2 = sModelInfo->getOperationInput(mNnapiOperationIndex, 1);
const auto& elementType1 = sModelInfo->getOperandType(operandIndex1);
const auto& elementType2 = sModelInfo->getOperandType(operandIndex2);
if ( !isValidInputTensor(0) || !isValidInputTensor(1) ) {
ALOGE("%s Empty or Invalid dimensions size for input", __func__);
return false;
}
ALOGV("%s PASSED", __func__);

// check if both tensors are of same type
if(elementType1 != elementType2 ) {
ALOGE("%s Input type mismatch", __func__);
const auto& activationIndex = sModelInfo->getOperationInput(mNnapiOperationIndex, 1);
if (!sModelInfo->isOperandLifeTimeConst(activationIndex)) {
ALOGE("%s Only Constant supported for specifying Activation", __func__);
return false;
} else if ( elementType1 == OperandType::TENSOR_INT32 ) {
//In 1.3 For a {@link OperandType::TENSOR_INT32} tensor,
//the {@link FusedActivationFunc} must be "NONE".
auto activationFn = sModelInfo->ParseOperationInput<uint32_t>(mNnapiOperationIndex, 2);
if (activationFn != 0) {
ALOGE("%s Activation type must be none for TENSOR_INT32 type", __func__);
return false;
}
}
ALOGV("%s PASSED", __func__);

return true;
}

Expand Down
5 changes: 0 additions & 5 deletions ngraph_creator/operations/src/AveragePool2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ bool AveragePool2D::validate() {
ALOGE("%s Invalid dimensions size for input(%lu)", __func__, inputDimensionsSize);
return false;
}
//check Input are of valid dimension or not
if ( !isValidInputTensor(0)) {
ALOGE("%s Empty or Invalid dimensions size for input", __func__);
return false;
}

ALOGV("%s PASSED", __func__);
return true;
Expand Down
24 changes: 0 additions & 24 deletions ngraph_creator/operations/src/DepthToSpace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,6 @@ DepthToSpace::DepthToSpace(int operationIndex) : OperationsBase(operationIndex)
mDefaultOutputIndex = sModelInfo->getOperationOutput(mNnapiOperationIndex, 0);
}

bool DepthToSpace::validate() {
// Check input rank
const auto inputRank = getInputOperandDimensions(0).size();

if (inputRank != 4) {
ALOGE("%s Invalid dimension of rank %d", __func__, inputRank);
return false;
}

if ( !isValidInputTensor(0)) {
ALOGE("%s Empty or Invalid dimensions size for input", __func__);
return false;
}

auto block_size = sModelInfo->ParseOperationInput<uint32_t>(mNnapiOperationIndex, 1);
if(block_size < 1) {
ALOGE("%s Invalid block size %d", __func__, block_size);
return false;
}

ALOGV("%s PASSED", __func__);
return true;
}

std::shared_ptr<ngraph::Node> DepthToSpace::createNode() {
// Creating input nodes
std::shared_ptr<ngraph::Node> input;
Expand Down
10 changes: 0 additions & 10 deletions ngraph_creator/operations/src/Dequantize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@ Dequantize::Dequantize(int operationIndex) : OperationsBase(operationIndex) {
mDefaultOutputIndex = sModelInfo->getOperationOutput(mNnapiOperationIndex, 0);
}

bool Dequantize::validate() {
if ( !isValidInputTensor(0)) {
ALOGE("%s Empty or Invalid dimensions size for input", __func__);
return false;
}

ALOGV("%s PASSED", __func__);
return true;
}

std::shared_ptr<ngraph::Node> Dequantize::createNode() {
// Creating input nodes
std::shared_ptr<ngraph::Node> input, outputNode;
Expand Down
27 changes: 0 additions & 27 deletions ngraph_creator/operations/src/Div.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,6 @@ Div::Div(int operationIndex) : OperationsBase(operationIndex) {
mDefaultOutputIndex = sModelInfo->getOperationOutput(mNnapiOperationIndex, 0);
}

bool Div::validate() {
auto operandIndex1 = sModelInfo->getOperationInput(mNnapiOperationIndex, 0);
auto operandIndex2 = sModelInfo->getOperationInput(mNnapiOperationIndex, 1);
const auto& elementType1 = sModelInfo->getOperandType(operandIndex1);
const auto& elementType2 = sModelInfo->getOperandType(operandIndex2);
if ( !isValidInputTensor(0) || !isValidInputTensor(1) ) {
ALOGE("%s Empty or Invalid dimensions size for input", __func__);
return false;
}

// check if both tensors are of same type
if(elementType1 != elementType2 ) {
ALOGE("%s Input type mismatch", __func__);
return false;
} else if ( elementType1 == OperandType::TENSOR_INT32 ) {
//In 1.3 For a {@link OperandType::TENSOR_INT32} tensor,
//the {@link FusedActivationFunc} must be "NONE".
auto activationFn = sModelInfo->ParseOperationInput<uint32_t>(mNnapiOperationIndex, 2);
if (activationFn != 0) {
ALOGE("%s Activation type must be none for TENSOR_INT32 type", __func__);
return false;
}
}
ALOGV("%s PASSED", __func__);
return true;
}

std::shared_ptr<ngraph::Node> Div::createNode() {
// Creating input nodes
auto input1 = getInputNode(0);
Expand Down
12 changes: 0 additions & 12 deletions ngraph_creator/operations/src/FullyConnected.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,6 @@ bool FullyConnected::validate() {
ALOGE("%s Invalid input parameter dimensions!!!", __func__);
return false;
}
//check operand lifetime
const auto& dimsOperandIndex1 = sModelInfo->getOperationInput(mNnapiOperationIndex, 0);
const auto& dimsOperandIndex2 = sModelInfo->getOperationInput(mNnapiOperationIndex, 1);
const auto& dimsOperandIndex3 = sModelInfo->getOperationInput(mNnapiOperationIndex, 2);
const auto& dimsOperandIndex4 = sModelInfo->getOperationInput(mNnapiOperationIndex, 3);
if(!sModelInfo->isOperandLifeTimeConst(dimsOperandIndex1) ||
!sModelInfo->isOperandLifeTimeConst(dimsOperandIndex2) ||
!sModelInfo->isOperandLifeTimeConst(dimsOperandIndex3) ||
!sModelInfo->isOperandLifeTimeConst(dimsOperandIndex4)) {
ALOGE("%s Only Const lifetime is supported", __func__);
return false;
}

ALOGD("%s succeeded", __func__);
return true;
Expand Down
16 changes: 0 additions & 16 deletions ngraph_creator/operations/src/L2Pooling2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,6 @@ L2Pooling2D::L2Pooling2D(int operationIndex) : OperationsBase(operationIndex) {
mDefaultOutputIndex = sModelInfo->getOperationOutput(mNnapiOperationIndex, 0);
}

bool L2Pooling2D::validate() {
const auto& inputDimensionsSize = getInputOperandDimensions(0).size();
if (inputDimensionsSize != 4) {
ALOGE("%s Invalid dimensions size for input(%lu)", __func__, inputDimensionsSize);
return false;
}
//check Input are of valid dimension or not
if ( !isValidInputTensor(0)) {
ALOGE("%s Empty or Invalid dimensions size for input", __func__);
return false;
}

ALOGV("%s PASSED", __func__);
return true;
}

std::shared_ptr<ngraph::Node> L2Pooling2D::createNode() {
const auto& inputsSize = sModelInfo->getOperationInputsSize(mNnapiOperationIndex);
bool isImplicit = false, isExplicit = false;
Expand Down
19 changes: 0 additions & 19 deletions ngraph_creator/operations/src/Less.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,6 @@ Less::Less(int operationIndex) : OperationsBase(operationIndex) {
mDefaultOutputIndex = sModelInfo->getOperationOutput(mNnapiOperationIndex, 0);
}

bool Less::validate() {
auto operandIndex1 = sModelInfo->getOperationInput(mNnapiOperationIndex, 0);
auto operandIndex2 = sModelInfo->getOperationInput(mNnapiOperationIndex, 1);
const auto& elementType1 = sModelInfo->getOperandType(operandIndex1);
const auto& elementType2 = sModelInfo->getOperandType(operandIndex2);
if ( !isValidInputTensor(0) || !isValidInputTensor(1) ) {
ALOGE("%s Empty or Invalid dimensions size for input", __func__);
return false;
}

// check if both tensors are of same type
if(elementType1 != elementType2 ) {
ALOGE("%s Input type mismatch", __func__);
return false;
}

ALOGV("%s PASSED", __func__);
return true;
}
std::shared_ptr<ngraph::Node> Less::createNode() {
// Creating input nodes
std::shared_ptr<ngraph::Node> input1, input2;
Expand Down
16 changes: 0 additions & 16 deletions ngraph_creator/operations/src/Logistic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,6 @@ Logistic::Logistic(int operationIndex) : OperationsBase(operationIndex) {
mDefaultOutputIndex = sModelInfo->getOperationOutput(mNnapiOperationIndex, 0);
}

bool Logistic::validate() {
const auto& inputDimensionsSize = getInputOperandDimensions(0).size();
if (inputDimensionsSize > 4) {
ALOGE("%s Invalid dimensions size for input(%lu)", __func__, inputDimensionsSize);
return false;
}
//check Input are of valid dimension or not
if ( !isValidInputTensor(0)) {
ALOGE("%s Empty or Invalid dimensions size for input", __func__);
return false;
}

ALOGV("%s PASSED", __func__);
return true;
}

std::shared_ptr<ngraph::Node> Logistic::createNode() {
// Creating input nodes
std::shared_ptr<ngraph::Node> input;
Expand Down
16 changes: 0 additions & 16 deletions ngraph_creator/operations/src/MaxPool2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,6 @@ MaxPool2d::MaxPool2d(int operationIndex) : OperationsBase(operationIndex) {
mDefaultOutputIndex = sModelInfo->getOperationOutput(mNnapiOperationIndex, 0);
}

bool MaxPool2d::validate() {
// Check Input Dimension size
const auto& inputDimensionsSize = getInputOperandDimensions(0).size();
if (inputDimensionsSize != 4) {
ALOGE("%s Invalid dimensions size for input(%lu)", __func__, inputDimensionsSize);
return false;
}
//check Input are of valid dimension or not
if ( !isValidInputTensor(0)) {
ALOGE("%s Empty or Invalid dimensions size for input", __func__);
return false;
}

ALOGV("%s PASSED", __func__);
return true;
}
std::shared_ptr<ngraph::Node> MaxPool2d::createNode() {
const auto& inputsSize = sModelInfo->getOperationInputsSize(mNnapiOperationIndex);
ALOGD("%s inputsSize %lu", __func__, inputsSize);
Expand Down
Loading