Comments (5)
When you call allocate
before configuring the function the tensor by default will be allocated with no padding. The ActivationLayer function tries to process 16 elements at once (in X direction) but since your tensor is smaller the end of the window is automatically reduced to prevent invalid memory accesses. In your case it is reduced all the way down to zero which later triggers the assertion. We will add a better error message to indicate the problem.
To use the ActivationLayer function your options are:
- to set the padding manually before allocating the tensors (
TensorInfo::extend_padding(PaddingSize)
), - to use auto padding which will be large enough to run any function but will allocate unnecessarily much memory for many functions (
TensorInfo::auto_padding()
, not recommended) or - to allocate the tensors after configuring the functions. In that case the function will update the padding according to their needs. But this can only be done if the tensors are not already allocated.
from computelibrary.
In your piece of code it's unclear where and how you allocate your buffers, could you please give us more details ?
from computelibrary.
We've tried to run the following code and it seems to work:
Tensor input;
Tensor output;
const TensorShape shape(14U, 14U, 192U);
input.allocator()->init(TensorInfo(shape, 1, DataType::F32));
output.allocator()->init(TensorInfo(shape, 1, DataType::F32));
NEActivationLayer activation;
activation.configure(&input, &output, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU));
input.allocator()->allocate();
//TODO: Fill the input's content
output.allocator()->allocate();
activation.run();
from computelibrary.
Hi @AnthonyARM ,
I found that if I call the allocate()
function before configure()
, it will crash.
The following code crashed.
input->allocator()->allocate();
output->allocator()->allocate();
activation.configure(input, output, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU));
activation.run();
The following code worked.
activation.configure(input, output, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU));
input->allocator()->allocate();
output->allocator()->allocate();
activation.run();
I have not got how to use Tensor
properly. ^_^!
This is the complete test code
const TensorShape shape(14U, 14U, 192U);
Tensor *input = new Tensor();
input->allocator()->init(TensorInfo(shape, Format::F32));
Tensor *output = new Tensor();
output->allocator()->init(TensorInfo(shape, Format::F32));
NEActivationLayer activation;
activation.configure(input, output, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU));
input->allocator()->allocate();
output->allocator()->allocate();
activation.run();
from computelibrary.
Cool! Thank you all.
from computelibrary.
Related Issues (20)
- linear+gelu fused operator is not supported in ACL HOT 6
- sparse gemm kernels are not supported in ACL HOT 5
- ACL operators need to be made stateless to avoid runtime initialization overhead HOT 2
- why compile_commands.json not generated? HOT 2
- ohos HOT 2
- Performance in NCHW layout operations HOT 1
- [OpenVINO 2023.2.0] ComputeLibrary/libarm_compute-static.a] sh: Argument list too long HOT 3
- Cast operation at Gpu backend should support DataType::QSYMM8 HOT 4
- Do you have group deconvolution layer? HOT 3
- CpuGemmConv2d optimization affects performance on Apple M2/M2 Pro HOT 9
- Uninitialized Regs used causes unintended behavior HOT 3
- Problem with graph_alexnet.cpp HOT 5
- NEMeanStdDevNormalizationLayer returns nans for f16 tensors HOT 3
- CPUInfo::get().has_fp16() returns true on RaspberryPi 4 HOT 3
- Compiling error on Raspberry Pi 5: HOT 3
- Unit test failure CPU/UNIT/Context/CpuCapabilities on WoA HOT 1
- Segfault when running DWC tests on WoA HOT 1
- Fix ACL WoA native build compiler errors HOT 1
- why L1_cache_size and L2_cache_size are constant value
- Question about quantization gemm example
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from computelibrary.