backwardTape used in MATLAB2021a

3 vues (au cours des 30 derniers jours)
Yimin
Yimin le 12 Avr 2024
Commenté : Walter Roberson le 13 Fév 2025
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.

Réponses (1)

AKennedy
AKennedy le 13 Fév 2025
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 commentaire
Walter Roberson
Walter Roberson le 13 Fév 2025
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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Deep Learning Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by