Skip to content

Commit 9b65a2d

Browse files
PetroZarytskyivgvassilev
authored andcommitted
Enable numerical testing for fn19 in STLCustomDerivatives.C
The crash when executing this gradient was fixed in #1610. Fixes #1420.
1 parent d5a5d8f commit 9b65a2d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

test/Gradient/STLCustomDerivatives.C

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,13 @@ int main() {
343343
TEST_GRADIENT(fn16, /*NumOfDerivativeArgs=*/2, 3, 1, &d_i, &d_j); // CHECK-EXEC: {48.00, 48.00}
344344
TEST_GRADIENT(fn17, /*numOfDerivativeArgs=*/2, 1, 1, &d_i, &d_j); // CHECK-EXEC: {1.00, 3.00}
345345
auto d_fn18 = clad::gradient(fn18, "tensor_theory_params");
346+
347+
Session s;
348+
s.arr[0] = 4; s.arr[1] = 3;
349+
float p[] = {9}, dp[] = {0};
346350
auto d_fn19 = clad::gradient(fn19, "tensor_theory_params");
351+
d_fn19.execute(&s, p, dp);
352+
printf("{%.2f}\n", dp[0]); // CHECK-EXEC: {7.00}
347353

348354
std::vector<double> v{1, 3, 5, 7, 9};
349355
std::vector<double> dv(5, 0);

0 commit comments

Comments
 (0)