@@ -393,36 +393,36 @@ extension Tensor: VectorProtocol where Scalar: TensorFlowFloatingPoint {
393
393
// Consider publicly exposing these operators when tensorflow/swift-apis is no
394
394
// longer built as part of the Swift standard library,
395
395
/*
396
- public extension VectorProtocol {
397
- static func + (lhs: VectorSpaceScalar, rhs: Self) -> Self {
398
- rhs.adding(lhs)
399
- }
396
+ public extension VectorProtocol {
397
+ static func + (lhs: VectorSpaceScalar, rhs: Self) -> Self {
398
+ rhs.adding(lhs)
399
+ }
400
400
401
- static func + (lhs: Self, rhs: VectorSpaceScalar) -> Self {
402
- lhs.adding(rhs)
403
- }
401
+ static func + (lhs: Self, rhs: VectorSpaceScalar) -> Self {
402
+ lhs.adding(rhs)
403
+ }
404
404
405
- static func - (lhs: Self, rhs: VectorSpaceScalar) -> Self {
406
- lhs.subtracting(rhs)
407
- }
405
+ static func - (lhs: Self, rhs: VectorSpaceScalar) -> Self {
406
+ lhs.subtracting(rhs)
407
+ }
408
408
409
- static func * (lhs: VectorSpaceScalar, rhs: Self) -> Self {
410
- rhs.scaled(by: lhs)
411
- }
409
+ static func * (lhs: VectorSpaceScalar, rhs: Self) -> Self {
410
+ rhs.scaled(by: lhs)
411
+ }
412
412
413
- static func * (lhs: Self, rhs: VectorSpaceScalar) -> Self {
414
- lhs.scaled(by: rhs)
415
- }
416
- }
413
+ static func * (lhs: Self, rhs: VectorSpaceScalar) -> Self {
414
+ lhs.scaled(by: rhs)
415
+ }
416
+ }
417
417
418
- public extension VectorProtocol where VectorSpaceScalar: SignedNumeric {
419
- static prefix func - (x: Self) -> Self {
420
- .zero - x
421
- }
418
+ public extension VectorProtocol where VectorSpaceScalar: SignedNumeric {
419
+ static prefix func - (x: Self) -> Self {
420
+ .zero - x
421
+ }
422
422
423
- static func - (lhs: VectorSpaceScalar, rhs: Self) -> Self {
424
- (-rhs).adding(lhs)
425
- }
423
+ static func - (lhs: VectorSpaceScalar, rhs: Self) -> Self {
424
+ (-rhs).adding(lhs)
425
+ }
426
426
}
427
427
*/
428
428
@@ -1472,9 +1472,9 @@ public func swish<T: TensorFlowFloatingPoint>(_ x: Tensor<T>) -> Tensor<T> {
1472
1472
x * sigmoid( x)
1473
1473
}
1474
1474
1475
- // Note: A custom vjp function for swish is required to avoid excessive
1476
- // tensor memory consumption due to storing both `x` and `sigmoid(x)` for
1477
- // backprop. This vjp recomputes `sigmoid(x)` during backprop, so that
1475
+ // Note: A custom vjp function for swish is required to avoid excessive
1476
+ // tensor memory consumption due to storing both `x` and `sigmoid(x)` for
1477
+ // backprop. This vjp recomputes `sigmoid(x)` during backprop, so that
1478
1478
// the `sigmoid(x)` expression can be freed during the forward pass.
1479
1479
@inlinable
1480
1480
@derivative ( of: swish)
0 commit comments