Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
PetroZarytskyi committed Jul 15, 2024
1 parent 8d941ce commit 0b018b3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,12 @@ namespace custom_derivatives {
double my_pow_darg1(dobule x, double y) { return my_pow(x, y) * std::log(x); }
}
```
You can also specify a custom gradient:
You can also specify a custom pullback:
```cpp
namespace custom_derivatives {
void my_pow_grad(double x, double y, array_ref<double> _d_x, array_ref<double> _d_y) {
void my_pow_pullback(double x, double y, double _d_y0, double *_d_x, double *_d_y) {
double t = my_pow(x, y - 1);
*_d_x = y * t;
*_d_x = y * t * _d_y0;
*_d_y = x * t * std::log(x);
}
}
Expand Down
4 changes: 2 additions & 2 deletions demos/ErrorEstimation/CustomModel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ clang++ -Xclang -add-plugin -Xclang clad -Xclang -load -Xclang CLAD_INST/lib/cla
To verify your results, you can build the dummy `test.cpp` file with the commands shown above. Once you compile and run the test file correctly, you will notice the generated code is as follows:

```cpp
The code is: void func_grad(float x, float y, float *_d_x, float *_d_y, double *_final_error) {
The code is: void func_pullback(float x, float y, float _d_y0, float *_d_x, float *_d_y, double *_final_error) {
float _d_z = 0;
float _t0;
float z;
_t0 = z;
z = x + y;
_d_z += 1;
_d_z += _d_y0;
{
*_final_error += _d_z * z;
z = _t0;
Expand Down
4 changes: 2 additions & 2 deletions demos/ErrorEstimation/PrintModel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ clang++ -Xclang -add-plugin -Xclang clad -Xclang -load -Xclang CLAD_INST/lib/cla
To verify your results, you can build the dummy `test.cpp` file with the commands shown above. Once you compile and run the test file correctly, you will notice the generated code is as follows:

```cpp
The code is: void func_grad(float x, float y, float *_d_x, float *_d_y, double *_final_error) {
The code is: void func_pullback(float x, float y, float _d_y0, float *_d_x, float *_d_y, double *_final_error) {
float _d_z = 0;
float _t0;
float z;
_t0 = z;
z = x + y;
_d_z += 1;
_d_z += _d_y0;
{
*_final_error += _d_z * z;
z = _t0;
Expand Down

0 comments on commit 0b018b3

Please sign in to comment.