{"action":"created","issue":{"url":"https://api.github.com/repos/apple/swift/issues/21601","repository_url":"https://api.github.com/repos/apple/swift","labels_url":"https://api.github.com/repos/apple/swift/issues/21601/labels{/name}","comments_url":"https://api.github.com/repos/apple/swift/issues/21601/comments","events_url":"https://api.github.com/repos/apple/swift/issues/21601/events","html_url":"https://github.com/apple/swift/pull/21601","id":395501875,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQxOTM5MzAz","number":21601,"title":"[AutoDiff]  Add a `@noDerivative` attribute on stored properties in a `Differentiable`-conforming struct declaration","user":{"login":"rxwei","id":856507,"node_id":"MDQ6VXNlcjg1NjUwNw==","avatar_url":"https://avatars0.githubusercontent.com/u/856507?v=4","gravatar_id":"","url":"https://api.github.com/users/rxwei","html_url":"https://github.com/rxwei","followers_url":"https://api.github.com/users/rxwei/followers","following_url":"https://api.github.com/users/rxwei/following{/other_user}","gists_url":"https://api.github.com/users/rxwei/gists{/gist_id}","starred_url":"https://api.github.com/users/rxwei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rxwei/subscriptions","organizations_url":"https://api.github.com/users/rxwei/orgs","repos_url":"https://api.github.com/users/rxwei/repos","events_url":"https://api.github.com/users/rxwei/events{/privacy}","received_events_url":"https://api.github.com/users/rxwei/received_events","type":"User","site_admin":false},"labels":[{"id":955546636,"node_id":"MDU6TGFiZWw5NTU1NDY2MzY=","url":"https://api.github.com/repos/apple/swift/labels/tensorflow","name":"tensorflow","color":"EF6C00","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2019-01-03T09:17:14Z","updated_at":"2019-01-04T02:11:04Z","closed_at":null,"author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/apple/swift/pulls/21601","html_url":"https://github.com/apple/swift/pull/21601","diff_url":"https://github.com/apple/swift/pull/21601.diff","patch_url":"https://github.com/apple/swift/pull/21601.patch"},"body":"* No longer check for `Parameterized` conformance in `Differentiable` synthesis.\r\n\r\n* Add a `@noDerivative` attribute that allows the user to tag a struct property as not having a derivative in the struct's `TangentVector` and `CotangentVector`. If the struct has not declared a conformance to `Differentiable`, emit a diagnostic.\r\n\r\n    ```swift\r\n    struct Foo : Differentiable {\r\n        var x: Sphere\r\n        var y: Vector<Float>\r\n        @noDerivative var z: Bool\r\n    }\r\n    ```\r\n\r\n    In this example, the derived `TangentVector` should be the following. The `CotangentVector` follows.\r\n\r\n    ```swift\r\n    // Nested within `Foo`:\r\n        @_fieldwiseProductSpace\r\n        struct TangentVector : Differentiable & VectorNumeric {\r\n            var x: Sphere.TangentVector\r\n            var y: Vector<Float>.TangentVector\r\n        }\r\n    ```\r\n\r\n    * Note: `Differentiable` synthesis is not complete for cases where the parent nominal type is not a vector space (conforms to `VectorNumeric`). It will be fixed in a separate PR.\r\n\r\n    * TODO: Emit a diagnostic if the property is a computed property.\r\n\r\n    * We could use `@nondiff`, but it is a type attribute, not a declaration attribute. We will need to do similar disambiguation in the parser for `@differentiable` and `@autodiff`. In the finished design, there will likely be only two attributes:\r\n        * `@noDerivative`, meaning \"there is no derivative for this variable\", available on function type parameters and stored property declarations, and\r\n        * `@differentiable`, meaning \"this is a differentiable function\", available on function declarations, property declarations, and function types.\r\n\r\n* Allow `@_fieldwiseProductSpace` on nominal type decls so that we (or `Differentiable` conformance synthesis) can add it to struct decls.\r\n\r\n* With `@noDerivative` and the updated `Differentiable` derived conformances, we may no longer need the `Parameterized` protocol or `@TFParameter` for TensorFlow applications."},"comment":{"url":"https://api.github.com/repos/apple/swift/issues/comments/451336321","html_url":"https://github.com/apple/swift/pull/21601#issuecomment-451336321","issue_url":"https://api.github.com/repos/apple/swift/issues/21601","id":451336321,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MTMzNjMyMQ==","user":{"login":"rxwei","id":856507,"node_id":"MDQ6VXNlcjg1NjUwNw==","avatar_url":"https://avatars0.githubusercontent.com/u/856507?v=4","gravatar_id":"","url":"https://api.github.com/users/rxwei","html_url":"https://github.com/rxwei","followers_url":"https://api.github.com/users/rxwei/followers","following_url":"https://api.github.com/users/rxwei/following{/other_user}","gists_url":"https://api.github.com/users/rxwei/gists{/gist_id}","starred_url":"https://api.github.com/users/rxwei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rxwei/subscriptions","organizations_url":"https://api.github.com/users/rxwei/orgs","repos_url":"https://api.github.com/users/rxwei/repos","events_url":"https://api.github.com/users/rxwei/events{/privacy}","received_events_url":"https://api.github.com/users/rxwei/received_events","type":"User","site_admin":false},"created_at":"2019-01-04T02:11:04Z","updated_at":"2019-01-04T02:11:04Z","author_association":"COLLABORATOR","body":"@swift-ci please test tensorflow"}}
{"actor":{"display_login":"rxwei"}}