Adds a workaround for what appears to be a REPL-only upstream bug affecting calls to print() (SR-13949).
This fix resolves the following failures.
a_swift_tour.ipynb:
nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
------------------
print(numbers.map({ (number: Int) -> Int in
let result = 3 * number
return result
}))
------------------
error: <Cell 34>:2:22: error: cannot find 'number' in scope
let result = 3 * number
^~~~~~
error: <Cell 34>:3:12: error: cannot find 'result' in scope
return result
^~~~~~
custom_differentiation.ipynb:
nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
------------------
var x: Float = 30
print(gradient(at: x) { x -> Float in
// Print the partial derivative with respect to the result of `sin(x)`.
let a = sin(x).withDerivative { print("∂+/∂sin = \($0)") }
// Force the partial derivative with respect to `x` to be `0.5`.
let b = log(x.withDerivative { (dx: inout Float) in
print("∂log/∂x = \(dx), but rewritten to 0.5");
dx = 0.5
})
return a + b
})
------------------
error: <Cell 4>:7:32: error: cannot find 'dx' in scope
print("∂log/∂x = \(dx), but rewritten to 0.5");
error: <Cell 4>:8:9: error: cannot find 'dx' in scope
dx = 0.5
^~
error: <Cell 4>:10:12: error: cannot find 'a' in scope
return a + b
^
error: <Cell 4>:10:16: error: cannot find 'b' in scope
return a + b
^
Adds a workaround for what appears to be a REPL-only upstream bug affecting calls to
print()
(SR-13949).This fix resolves the following failures.
a_swift_tour.ipynb:
custom_differentiation.ipynb: