Comments (4)
Sorry, this is a bug!
It seems that you are running the compiler-integrated REPL, which doesn't yet support TensorFlow (because the new TensorFlow-specific compiler passes aren't being run in executeSwiftSource
).
I'll work on fixing this - in the meantime you'll have to build LLDB to use the REPL.
The easiest way to do so is to use the tensorflow_osx
and tensorflow_linux
build presets:
macOS:
# First, you'll need to create a Keychain Access certificate called "lldb_codesign".
# Follow the instructions here:
# https://github.com/llvm-mirror/lldb/blob/master/docs/code-signing.txt
SWIFT_PACKAGE=tensorflow_osx swift/utils/build-toolchain
Linux:
SWIFT_PACKAGE=tensorflow_linux swift/utils/build-toolchain
After building, you can run the LLDB-enabled REPL like so:
swift/swift-nightly-install/usr/bin/swift
You should see a prompt like:
Welcome to Swift version 4.2-dev (LLVM 04bdb56f3d, Clang b44dbbdf44). Type :help for assistance.
1>
Please note that these build presets are likely to change frequently.
from swift.
Thanks! I'll try it.
from swift.
This is fixed in 5233a8f.
Verified on macOS and Ubuntu 16.04. (On Ubuntu 14.04, I got this "internal REPL unimplemented" error).
I ran the REPL like so:
$ build/buildbot_osx/swift-macosx-x86_64/bin/swift -O
*** You are running Swift's integrated REPL, ***
*** intended for compiler and stdlib ***
*** development and testing purposes only. ***
*** The full REPL is built as part of LLDB. ***
*** Type ':help' for assistance. ***
(swift) import TensorFlow
(swift) var x = Tensor([[1, 2], [3, 4]])
// x : Tensor<Double> = [[1.0, 2.0], [3.0, 4.0]]
(swift) x * x
// r0 : Tensor<Double> = [[1.0, 4.0], [9.0, 16.0]]
(swift) for _ in 0..<3 {
x += x
}
(swift) x
// x : Tensor<Double> = [[8.0, 16.0], [24.0, 32.0]]
Notice that it's necessary to specify -O
when running the compiler-integrated compiler. It's easy to turn on -O
by default but we should avoid doing so when possible.
from swift.
Cool! Thanks. I will try it.
from swift.
Related Issues (20)
- Close all open issues and pull requests since this repository has been moved
- Python linking in xcode HOT 5
- Internal error when `public`s are removed from the catch model HOT 3
- Configuring swift-format's line breaking rule
- Add build instructions to Readme
- Error building swift-format HOT 1
- Translation of Google Swift Style Guide
- Unexpected newline before opening brace for method calls with trailing closures
- The rule NoAccessLevelOnExtensionDeclaration doesn't work
- testEagerLoop() in crashers.swift crashers in TFLowerGraph.cpp, after supporting TF tensor receives HOT 1
- Use SILPrinter callback mechanism to annotate the printed SIL code HOT 2
- Bridge Python `numpy.ndarray` to `Array` and `Tensor` HOT 2
- Crash when doing basic Swift's String Interpolation. HOT 10
- [Ubuntu] `Python.import("numpy")` fails in the REPL HOT 5
- Non-data dependent code with side effects - should they sync? HOT 8
- Implement UseOnlySpaces HOT 1
- Implement UseTripleSlashForDocumentationComments HOT 1
- implement NeverUseForceTry HOT 1
- Implement NeverUseImplicitlyUnwrappedOptionals HOT 1
- Implement CyclomaticComplexityWarning.swift HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swift.