You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 1, 2023. It is now read-only.
When taking the gradient of a function, the function must return a scalar.
Because Tensors do not encode their shape or rank, this is checked dynamically
at runtime. Previously, we did not provide an explicit error message, resulting in the
following printed to the console:
```
Precondition failed: file /swift-base/tensorflow-swift-apis/Sources/TensorFlow/Core/DifferentialOperators.swift, line 68
Current stack trace:
0 libswiftCore.so 0x00007f1629f45830 swift_reportError + 50
1 libswiftCore.so 0x00007f1629fb45d0 _swift_stdlib_reportFatalErrorInFile + 115
2 libswiftCore.so 0x00007f1629edca7e <unavailable> + 3734142
3 libswiftCore.so 0x00007f1629edcbf7 <unavailable> + 3734519
4 libswiftCore.so 0x00007f1629cab10d <unavailable> + 1433869
5 libswiftCore.so 0x00007f1629eb1a88 <unavailable> + 3558024
6 libswiftCore.so 0x00007f1629caa569 <unavailable> + 1430889
9 repl_swift 0x0000000000400490 <unavailable> + 1168
11 libswiftCore.so 0x00007f1629caa569 <unavailable> + 1430889
14 repl_swift 0x0000000000400490 <unavailable> + 1168
16 libswiftCore.so 0x00007f1629caa569 <unavailable> + 1430889
17 libswiftTensorFlow.so 0x00007f16272250b0 <unavailable> + 2543792
18 libswiftTensorFlow.so 0x00007f1627098280 checkOk(_:file:line:) + 467
19 libswiftTensorFlow.so 0x00007f162709f480 TFE_Op.evaluateUnsafe() + 506
20 libswiftTensorFlow.so 0x00007f162709fcf0 TFE_Op.execute<A>(_:) + 132
21 libswiftTensorFlow.so 0x00007f16270a8984 <unavailable> + 985476
22 libswiftTensorFlow.so 0x00007f162713dc20 static Raw.matMul<A>(_:_:transposeA:transposeB:) + 1221
23 libswiftTensorFlow.so 0x00007f1627293c00 matmul<A>(_:transposed:_:transposed:) + 1427
24 libswiftTensorFlow.so 0x00007f16272f6210 _vjpMatmul<A>(_:transposed:_:transposed:) + 201
25 libswiftTensorFlow.so 0x00007f16273564b4 <unavailable> + 3794100
26 libswiftTensorFlow.so 0x00007f162731f960 AD__$s10TensorFlow5DenseV14callAsFunctionyAA0A0VyxGAGF__vjp_src_0_wrt_0_1 + 680
31 repl_swift 0x0000000000400490 <unavailable> + 1168
Current stack trace:
frame #4: 0x00007f162b926120 $__lldb_expr57`main at <Cell 8>:1
```
This change provides the user with a bit more context and prints out the shape
their computation produced to help them debug what might have gone wrong.
0 commit comments