backwardTape used in MATLAB2021a

5 visualizaciones (últimos 30 días)
Yimin
Yimin el 12 de Abr. de 2024
Comentada: Walter Roberson el 13 de Feb. de 2025 a las 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.

Respuestas (1)

AKennedy
AKennedy el 13 de Feb. de 2025 a las 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 comentario
Walter Roberson
Walter Roberson el 13 de Feb. de 2025 a las 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.

Iniciar sesión para comentar.

Categorías

Más información sobre Parallel and Cloud en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by