@swift-ci Please test tensorflow
The activity analysis changes cause new non-differentiability errors during TensorFlow
module compilation:
/home/swiftci/jenkins/workspace/swift-PR-TensorFlow-Linux/tensorflow-swift-apis/Sources/TensorFlow/Layers/Recurrent.swift:417:6: error: function is not differentiable
@differentiable(wrt: (self, inputs))
~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/swiftci/jenkins/workspace/swift-PR-TensorFlow-Linux/tensorflow-swift-apis/Sources/TensorFlow/Layers/Recurrent.swift:418:17: note: when differentiating this function definition
public func lastOutput(
^
/home/swiftci/jenkins/workspace/swift-PR-TensorFlow-Linux/tensorflow-swift-apis/Sources/TensorFlow/Layers/Recurrent.swift:423:86: note: cannot differentiate through a non-differentiable result; do you want to use 'withoutDerivative(at:)'?
return self(inputs, initialState: initialState)[withoutDerivative(at: inputs.count - 1)]
^
/home/swiftci/jenkins/workspace/swift-PR-TensorFlow-Linux/tensorflow-swift-apis/Sources/TensorFlow/Operators/Basic.swift:518:65: error: expression is not differentiable
let batchIndices: Tensor<Index> = withoutDerivative(at: {
^
/home/swiftci/jenkins/workspace/swift-PR-TensorFlow-Linux/tensorflow-swift-apis/Sources/TensorFlow/Operators/Basic.swift:518:65: note: differentiated functions in '@inlinable' functions must be marked '@differentiable' or have a public '@derivative'; this is not possible with a closure, make a top-level function instead
let batchIndices: Tensor<Index> = withoutDerivative(at: {
^
Investigating now.
It would be nice if the cannot differentiate through a non-differentiable result
error showed the name of the referenced Swift declaration (if one exists).
Edit: these errors were due to incorrect (unintentional) activity analysis changes. Fixed in 9779e05.
@swift-ci Please clean test tensorflow
Login to write a write a comment.
Semantically, yielded addresses of
modify
accessor applications can be viewedas projections into
inout
arguments.Activity analysis should reflect this assumption: yielded addresses should
propagate variedness and usefulness to
inout
arguments ofmodify
accessorapplications.
Now, previously undetected active
modify
accessor applications are diagnosed.Resolves TF-1115.
TF-1080 tracks
modify
accessor differentiation support.Example
modify
accessor application:If
%array
is active,%x
should also be active.Before this patch, active
%array
did not always imply active%x
.TF-1115 example (undiagnosed active
modify
accessor application):Before:
After:
Note: the assumption that yielded addresses are always a projection into
the
inout
argument is a safe over-approximation but not always true.In practice, this should be fine for now.
Example: