backwardTape used in MATLAB2021a

조회 수: 2 (최근 30일)
Yimin
Yimin 2024년 4월 12일
댓글: Walter Roberson 2025년 2월 13일
I need to make some modification in built-in function when called backwardTape"
grad = backwardTape(tm,{y},{initialAdjoint},x,retainData,false,0);"
at MATLAB2021a. However, I could see the nested function when called
grad = backwardTape(tm,{y},{initialAdjoint},x,retainData,false,0)
But where is the backwardTape function? As I am running MATLAB in a cluster so I don't have authority to overwrite the built-in function called by backwardTape so I need to save some functions in my drive that I could overwrite functions.

답변 (1개)

AKennedy
AKennedy 2025년 2월 13일
In MATLAB, built-in functions like backwardTape are typically part of the proprietary codebase and are not directly accessible or modifiable by users. However, you can work around this limitation by creating a wrapper function or script that calls backwardTape and then processes its outputs according to your needs.
  • Create a Wrapper Function:
function grad = myBackwardTapeWrapper(tm, y, initialAdjoint, x, retainData)
% Call the original function
grad = backwardTape(tm, {y}, {initialAdjoint}, x, retainData, false, 0);
% Modify grad as needed
% grad = yourModificationFunction(grad);
end
  • Use the Wrapper: Save this function in your MATLAB path or specify its location when calling it.
  • Ensure the wrapper is accessible on the cluster.
  댓글 수: 1
Walter Roberson
Walter Roberson 2025년 2월 13일
backwardTape is defined in deep.internal.recording.operations.DlconvBackwardOp as a method of deep.internal.recording.TapeManager . I am not sure that calling it through a wrapper is even possible.
In any case you would have to copy @dlarray and modify the copy in order to call the wrapper instead of the direct function.

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

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by