Skip to content
Snippets Groups Projects
Commit 2ec31f7f authored by Grégoire Kubler's avatar Grégoire Kubler
Browse files

Merge remote-tracking branch 'EclipseRepo/dev' into feat/operator_globalAveragePooling

parents 481b7a78 5ff8d30b
No related branches found
No related tags found
3 merge requests!50version 0.2.0,!47Draft: TEST_CI_FORK_DO_NOT_MERGE,!42feat/operator_globalAveragePooling
......@@ -25,7 +25,7 @@ void ReLUImpl_cpu_forward_kernel(std::size_t inputLenght,
const I* input = static_cast<const I*>(input_);
O* output = static_cast<O*>(output_);
#pragma omp parallel for if (inputLenght > 1024)
//#pragma omp parallel for if (inputLenght > 1024)
for (std::size_t i = 0; i < inputLenght; ++i) {
output[i] = input[i] > 0 ? input[i] : 0;
}
......
......@@ -25,7 +25,7 @@ void SigmoidImpl_cpu_forward_kernel(std::size_t inputLenght,
const I* input = static_cast<const I*>(input_);
O* output = static_cast<O*>(output_);
#pragma omp parallel for if (inputLenght > 1024)
//#pragma omp parallel for if (inputLenght > 1024)
for (std::size_t i = 0; i < inputLenght; ++i) {
output[i] = static_cast<O>(1.0) / (static_cast<O>(1.0) + std::exp(-input[i]));
}
......
......@@ -25,7 +25,7 @@ void TanhImpl_cpu_forward_kernel(std::size_t inputLenght,
const I* input = static_cast<const I*>(input_);
O* output = static_cast<O*>(output_);
#pragma omp parallel for if (inputLenght > 1024)
//#pragma omp parallel for if (inputLenght > 1024)
for (std::size_t i = 0; i < inputLenght; ++i) {
output[i] = std::tanh(input[i]);
}
......
......@@ -91,16 +91,10 @@ void Aidge::DivImpl_cpu::forward() {
std::size_t contiguousIdx = nbDims - 1;
for (; contiguousIdx+1 > 0; --contiguousIdx) {
if (dims0[contiguousIdx] != dims1[contiguousIdx]) {
if (contiguousIdx == (nbDims -1)) {
if (dims0[contiguousIdx] == 1) {
while ((dims0[contiguousIdx] == 1) && (contiguousIdx+1 > 0)) {
--contiguousIdx;
}
}
else {
while ((dims1[contiguousIdx] == 1) && (contiguousIdx+1 > 0)) {
--contiguousIdx;
}
if (contiguousIdx == (nbDims -1)) { // last dimensions of one of the input Tensor are of size 1
const std::vector<std::size_t>& dims = (dims0[contiguousIdx] == 1) ? dims0 : dims1;
while ((contiguousIdx+1 > 0) && (dims[contiguousIdx] == 1)) {
--contiguousIdx;
}
}
break;
......
......@@ -57,9 +57,10 @@ void Aidge::FCImpl_cpu::forward()
const auto& input2 = std::static_pointer_cast<Tensor>(mOp.getRawInput(2))->refCastFrom(input2Fallback, *std::static_pointer_cast<Tensor>(mOp.getRawOutput(0)));
// Call kernel
const auto batchSize = (input0.dims().size() > 1) ? input0.dims()[0] : 1;
kernelFunc(dynamic_cast<const FC_Op&>(mOp).getStaticAttributes(),
input0.dims()[0],
input0.size() / input0.dims()[0],
batchSize,
input0.size() / batchSize,
input0.getImpl()->rawPtr(), input1.getImpl()->rawPtr(), input2.getImpl()->rawPtr(),
getCPUPtr(mOp.getRawOutput(0)));
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment