Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit 7e93db5

Browse files
authored
Shallow Water PDE: make build on Windows (#693)
We need to import `MSVCRT` (or rather the new name of `CRT`) to get the type-generic operations as the C library functions which are referenced here expect double values but the values being used are single precision (`Float`) which fails to type-check.
1 parent 7ed2962 commit 7e93db5

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

Examples/Shallow-Water-PDE/ArrayLoopSolution.swift

+8
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@
1414

1515
import TensorFlow
1616

17+
#if os(Windows)
18+
#if canImport(CRT)
19+
import CRT
20+
#else
21+
import MSVCRT
22+
#endif
23+
#endif
24+
1725
// MARK: Solution of shallow water equation
1826

1927
/// Differentiable solution of shallow water equation on a unit square.

Examples/Shallow-Water-PDE/TensorConvSolution.swift

+8
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@
1414

1515
import TensorFlow
1616

17+
#if os(Windows)
18+
#if canImport(CRT)
19+
import CRT
20+
#else
21+
import MSVCRT
22+
#endif
23+
#endif
24+
1725
// MARK: Solution of shallow water equation
1826

1927
/// Differentiable solution of shallow water equation on a unit square.

Examples/Shallow-Water-PDE/TensorLoopSolution.swift

+8
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@
1414

1515
import TensorFlow
1616

17+
#if os(Windows)
18+
#if canImport(CRT)
19+
import CRT
20+
#else
21+
import MSVCRT
22+
#endif
23+
#endif
24+
1725
// MARK: Solution of shallow water equation
1826

1927
/// Differentiable solution of shallow water equation on a unit square.

Examples/Shallow-Water-PDE/TensorSliceSolution.swift

+8
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@
1414

1515
import TensorFlow
1616

17+
#if os(Windows)
18+
#if canImport(CRT)
19+
import CRT
20+
#else
21+
import MSVCRT
22+
#endif
23+
#endif
24+
1725
// MARK: Solution of shallow water equation
1826

1927
/// Differentiable solution of shallow water equation on a unit square.

0 commit comments

Comments
 (0)