backwardTape used in MATLAB2021a

5 ビュー (過去 30 日間)
Yimin
Yimin 2024 年 4 月 12 日
コメント済み: Walter Roberson 2025 年 2 月 13 日 3:40
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 日 3:18
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 日 3:40
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 Center および File ExchangeParallel and Cloud についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by