This repository was archived by the owner on Apr 23, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +31
-7
lines changed
Expand file tree Collapse file tree 6 files changed +31
-7
lines changed Original file line number Diff line number Diff line change 7676 "\n",
7777 "// Imaging capabilities\n",
7878 "%include \"EnableIPythonDisplay.swift\"\n",
79- "import Python\n",
79+ "#if canImport(PythonKit)\n",
80+ " import PythonKit\n",
81+ "#else",
82+ " import Python\n",
83+ "#endif",
8084 "let plt = Python.import(\"matplotlib.pyplot\")\n",
8185 "IPythonDisplay.shell.enable_matplotlib(\"inline\")\n",
8286 "\n",
357361 },
358362 "nbformat": 4,
359363 "nbformat_minor": 1
360- }
364+ }
Original file line number Diff line number Diff line change 1212// See the License for the specific language governing permissions and
1313// limitations under the License.
1414
15- import Python
15+ #if canImport(PythonKit)
16+ import PythonKit
17+ #else
18+ import Python
19+ #endif
1620import TensorFlow
1721
1822let iterationCount = 10000
Original file line number Diff line number Diff line change 1212// See the License for the specific language governing permissions and
1313// limitations under the License.
1414
15- import Python
15+ #if canImport(PythonKit)
16+ import PythonKit
17+ #else
18+ import Python
19+ #endif
1620import TensorFlow
1721
1822// Force unwrapping with `!` does not provide source location when unwrapping `nil`, so we instead
Original file line number Diff line number Diff line change 1212// See the License for the specific language governing permissions and
1313// limitations under the License.
1414
15- import Python
15+ #if canImport(PythonKit)
16+ import PythonKit
17+ #else
18+ import Python
19+ #endif
1620import TensorFlow
1721
1822// Force unwrapping with `!` does not provide source location when unwrapping `nil`, so we instead
Original file line number Diff line number Diff line change 1313// limitations under the License.
1414
1515import TensorFlow
16- import Python
16+ #if canImport(PythonKit)
17+ import PythonKit
18+ #else
19+ import Python
20+ #endif
1721
1822struct TimeDistributed : Layer {
1923 var dense : Dense < Float >
Original file line number Diff line number Diff line change 1414
1515import Foundation
1616import ModelSupport
17- import Python
17+ #if canImport(PythonKit)
18+ import PythonKit
19+ #else
20+ import Python
21+ #endif
1822import TensorFlow
1923import Transformer
2024
You can’t perform that action at this time.
0 commit comments