Skip to content
This repository was archived by the owner on Jul 1, 2023. It is now read-only.

Commit 7a1c931

Browse files
authored
TensorFlow: import _Differentiation more thoroughly (#1121)
While experimenting with building with the standard toolchain, these sites were uncovered as requiring additional importing of the `_Differentiation` module. When building with the tensorflow branch, this import is implicit. This should be an entirely invisible change to users.
1 parent 86b86ca commit 7a1c931

File tree

8 files changed

+12
-2
lines changed

8 files changed

+12
-2
lines changed

Sources/TensorFlow/Core/Tensor.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
import CTensorFlow
1615
import _Differentiation
16+
import CTensorFlow
1717

1818
infix operator .==: ComparisonPrecedence
1919
infix operator .!=: ComparisonPrecedence

Sources/TensorFlow/Layer.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
import Foundation
1615
import _Differentiation
16+
import Foundation
1717

1818
public protocol Module: EuclideanDifferentiable, KeyPathIterable
1919
where

Sources/TensorFlow/Optimizers/MomentumBased.swift

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
import _Differentiation
16+
1517
/// A RMSProp optimizer.
1618
///
1719
/// Implements the RMSProp optimization algorithm. RMSProp is a form of stochastic gradient descent

Sources/TensorFlow/Optimizers/Optimizer.swift

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
import _Differentiation
16+
1517
/// A numerical optimizer.
1618
///
1719
/// Optimizers apply an optimization algorithm to update a differentiable model.

Sources/TensorFlow/Optimizers/SGD.swift

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
import _Differentiation
16+
1517
/// A stochastic gradient descent (SGD) optimizer.
1618
///
1719
/// Implements the stochastic gradient descent algorithm with support for momentum, learning rate

Sources/TensorFlow/StdlibExtensions.swift

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
import _Differentiation
16+
1517
// MARK: - Array extensions
1618

1719
extension Array: ElementaryFunctions where Element: ElementaryFunctions {

Sources/x10/swift_bindings/optimizers/Optimizer.swift

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
import _Differentiation
1516
import TensorFlow
1617
@_exported import x10_optimizers_tensor_visitor_plan
1718

Sources/x10/swift_bindings/optimizers/TensorVisitorPlan.swift

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
import _Differentiation
1516
import TensorFlow
1617

1718
typealias GradMapFn = (inout Tensor<Float>, Tensor<Float>, Int) -> Void

0 commit comments

Comments
 (0)