Clear Filters
Clear Filters

backwardTape used in MATLAB2021a

2 views (last 30 days)
Yimin
Yimin on 12 Apr 2024
Answered: Sanju on 7 May 2024
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.

Answers (1)

Sanju
Sanju on 7 May 2024
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!

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!