-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[stdlib] [Sema] Add broadcasting 'adding(_:)' and 'subtracting(_:)' to 'VectorProtocol'. #25525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
976f841
to
f962f20
Compare
…o 'VectorProtocol'. Also make their implementations compiler-derivable.
f962f20
to
965e2fb
Compare
Ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I believe the existing test/Sema/struct_vector_protocol.swift
is sufficient for testing.
@@ -268,18 +266,32 @@ static ValueDecl *deriveVectorProtocol_scaled(DerivedConformance &derived) { | |||
auto scalarType = deriveVectorProtocol_VectorSpaceScalar(nominal, parentDC) | |||
->mapTypeOutOfContext(); | |||
|
|||
auto bodySynthesizer = [](AbstractFunctionDecl *funcDecl, void *ctx) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice utilization of BodySynthesizer
's context!
Default-implemented broadcasting operators such as error: the compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions
let loss = maxLogitsWithZero - logits * labels + log(1 + exp(-abs(logits)))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed. So I removed all operators in |
@swift-ci please test tensorflow |
1 similar comment
@swift-ci please test tensorflow |
@swift-ci please test tensorflow |
1 similar comment
@swift-ci please test tensorflow |
@swift-ci please test tensorflow Linux |
adding(_:)
andsubtracting(_:)
in a protocol extension.VectorProtocol
because a source breakage has been found.