How to measure the execution time for ReLu, Maxpool, fullyconnect in deep neural network?

조회 수: 5 (최근 30일)
I need to measure time taken to execute individual layer in a CNN model such as AlexNet. The total time for execution was determined by tic and toc functions.

답변 (1개)

Muskan
Muskan 2023년 5월 15일
Hi Isuru,
As per my understanding in MATLAB, you can measure the execution time for ReLU, Maxpool, and fully connected layers in a deep neural network using the built-in profiler tools. Here are the steps you can follow:
  1. Enable the Profiler: First, you need to enable the profiler tools in MATLAB. To do this, type profile on in the MATLAB command window.
  2. Create the Neural Network: Create your deep neural network using MATLAB's Deep Learning Toolbox.
  3. Collect Performance Data: Next, run your neural network with the sim function and collect performance data using the profile() function. You can also use the tic and toc functions to measure the execution time of specific code segments.
Example:
inputData = rand(28*28, 100);
reluLayer = reluLayer();
tic;
outputData = reluLayer.forward(inputData);
toc;
You can refer to the following documentation for better understanding:
Thanks
  댓글 수: 2
ISURU SAMARAKOON
ISURU SAMARAKOON 2023년 5월 15일
@Muskan, Thank you very much for your support. However I have observed that there is a difference in time from tic toc function and profiler. So which method is more accurate?
Matt J
Matt J 2023년 5월 15일
편집: Matt J 2023년 5월 15일
This doesn't seem to work,
inputData = rand(28*28, 100);
reluLayer = reluLayer();
tic;
outputData = reluLayer.forward(inputData);
Unrecognized method, property, or field 'forward' for class 'nnet.cnn.layer.ReLULayer'.
toc;

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by