backwardTape used in MATLAB2021a

조회 수: 6 (최근 30일)
Yimin
Yimin 2024년 4월 12일
답변: Sanju 2024년 5월 7일
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개)

Sanju
Sanju 2024년 5월 7일
Hi Yimin,
If you want to modify the behavior of the backwardTape function in MATLAB, but you don't have the authority to overwrite the built-in function directly, you can create your own version of the function and save it to your local drive.
Here's an outline,
  • Since backwardTape is a built-in function, you won't find its source code directly. However, you can access its functionality through the MATLAB debugger by typing edit backwardTape in the MATLAB command window. This will open the file if it's accessible.
  • Once you understand the functionality of backwardTape, you can create your own version with the modifications you need. You can write this custom function in a MATLAB script file (.m file) and save it to your local drive.For example, you might create a file called my_backwardTape.m and define your modified version of the function there.
  • Inside your custom function, you can modify the behavior as needed. Make sure to retain the same function signature (input and output arguments) so that your code continues to work seamlessly with existing code.
  • MATLAB searches for functions in the current folder and any folders on the MATLAB path. Make sure the folder containing your custom function is on the MATLAB path.
  • Instead of calling the built-in backwardTape, call your custom version (my_backwardTape) in your code.
Additionally, saving your custom function to your local drive ensures that you can access and use it regardless of where you're running MATLAB.
Hope this helps!

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by