Giter Site home page Giter Site logo

tensorflow / swift Goto Github PK

View Code? Open in Web Editor NEW
6.1K 261.0 606.0 3.54 MB

Swift for TensorFlow

Home Page: https://tensorflow.org/swift

License: Apache License 2.0

Jupyter Notebook 90.98% Swift 8.79% Shell 0.17% Dockerfile 0.06%
machine-learning differentiable-programming tensorflow

swift's Introduction

Swift for TensorFlow (Archived)

Swift for TensorFlow was an experiment in the next-generation platform for machine learning, incorporating the latest research across machine learning, compilers, differentiable programming, systems design, and beyond. It was archived in February 2021. Some significant achievements from this project include:

This site will not receive further updates. The API documentation and binary downloads will continue to be accessible as well as the Open Design Review meeting recordings.

Getting started

Using Swift for TensorFlow

Tutorials

Tutorial Last Updated
A Swift Tour March 2019
Protocol-Oriented Programming & Generics August 2019
Python Interoperability March 2019
Custom Differentiation March 2019
Sharp Edges in Differentiability November 2020
Model Training Walkthrough March 2019
Raw TensorFlow Operators December 2019
Introducing X10, an XLA-Based Backend May 2020

Resources

Forums

The discussions happened on the [email protected] mailing list.

Why Swift for TensorFlow?

Swift for TensorFlow is a new way to develop machine learning models. It gives you the power of TensorFlow directly integrated into the Swift programming language. We believe that machine learning paradigms are so important that they deserve first-class language and compiler support.

A fundamental primitive in machine learning is gradient-based optimization: computing function derivatives to optimize parameters. With Swift for TensorFlow, you can easily differentiate functions using differential operators like gradient(of:), or differentiate with respect to an entire model by calling method gradient(in:). These differentiation APIs are not just available for Tensor-related concepts—they are generalized for all types that conform to the Differentiable protocol, including Float, Double, SIMD vectors, and your own data structures.

// Custom differentiable type.
struct Model: Differentiable {
    var w: Float
    var b: Float
    func applied(to input: Float) -> Float {
        return w * input + b
    }
}

// Differentiate using `gradient(at:_:in:)`.
let model = Model(w: 4, b: 3)
let input: Float = 2
let (𝛁model, 𝛁input) = gradient(at: model, input) { model, input in
    model.applied(to: input)
}

print(𝛁model) // Model.TangentVector(w: 2.0, b: 1.0)
print(𝛁input) // 4.0

Beyond derivatives, the Swift for TensorFlow project comes with a sophisticated toolchain to make users more productive. You can run Swift interactively in a Jupyter notebook, and get helpful autocomplete suggestions to help you explore the massive API surface of a modern deep learning library. You can get started right in your browser in seconds!

Migrating to Swift for TensorFlow is really easy thanks to Swift's powerful Python integration. You can incrementally migrate your Python code over (or continue to use your favorite Python libraries), because you can easily call your favorite Python library with a familiar syntax:

import TensorFlow
import Python

let np = Python.import("numpy")

let array = np.arange(100).reshape(10, 10)  // Create a 10x10 numpy array.
let tensor = Tensor<Float>(numpy: array)  // Seamless integration!

Documentation

Beware: the project is moving very quickly, and thus some of these documents are slightly out of date as compared to the current state-of-the-art.

Overview

Document Last Updated Status
Why Swift for TensorFlow? April 2018 Current
Swift for TensorFlow Design Overview April 2018 Outdated
Supported Backends May 2020 Current

Technology deep dive

The Swift for TensorFlow project builds on top of powerful theoretical foundations. For insight into some of the underlying technologies, check out the following documentation.

Document Last Updated Status
Swift Differentiable Programming Manifesto January 2020 Current
Swift Differentiable Programming Implementation Overview August 2019 Current
Swift Differentiable Programming Design Overview June 2019 Outdated
Differentiable Types March 2019 Outdated
Differentiable Functions and Differentiation APIs March 2019 Outdated
Dynamic Property Iteration using Key Paths March 2019 Current
Hierarchical Parameter Iteration and Optimization March 2019 Current
First-Class Automatic Differentiation in Swift: A Manifesto October 2018 Outdated
Automatic Differentiation Whitepaper April 2018 Outdated
Python Interoperability April 2018 Current
Graph Program Extraction April 2018 Outdated

Source code

Compiler and standard library development happens on the main branch of the apple/swift repository.

Additional code repositories that make up the core of the project include:

Swift for TensorFlow is no longer a fork of the official Swift language; development was previously done on the tensorflow branch of the apple/swift repository. Language additions were designed to fit with the direction of Swift and are going through the Swift Evolution process.

Jupyter Notebook support

Jupyter Notebook support for Swift is under development at google/swift-jupyter.

Model garden

tensorflow/swift-models is a repository of machine learning models built with Swift for TensorFlow. It intended to provide examples of how to use Swift for TensorFlow, to allow for end-to-end tests of machine learning APIs, and to host model benchmarking infrastructure.

SwiftAI

fastai/swiftai is a high-level API for Swift for TensorFlow, modeled after the fastai Python library.

Community

Swift for TensorFlow discussions happen on the [email protected] mailing list.

Bugs reports and feature requests

Before reporting an issue, please check the Frequently Asked Questions to see if your question has already been addressed.

For questions about general use or feature requests, please send an email to the mailing list or search for relevant issues in the JIRA issue tracker.

For the most part, the core team's development is also tracked in JIRA.

Contributing

We welcome contributions from everyone. Read the contributing guide for information on how to get started.

Code of conduct

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

The Swift for TensorFlow community is guided by our Code of Conduct, which we encourage everybody to read before participating.

swift's People

Contributors

8bitmp3 avatar asuhan avatar bartchr808 avatar bgogul avatar bradlarson avatar brettkoonce avatar compnerd avatar dan-zheng avatar dynamicwebpaige avatar eaplatanios avatar eclipsegst avatar ematejska avatar lamberta avatar lattner avatar lilies avatar marcrasi avatar mhong avatar migueldeicaza avatar mikkeyboi avatar mikowals avatar owenv avatar porterchild avatar prayash avatar rxwei avatar saeta avatar shadaj avatar shashi456 avatar texasmichelle avatar volodymyrpavliukevych avatar yashk2810 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swift's Issues

internal error generating TensorFlow graph: GraphGen cannot lower a 'send' to the host yet

Hey All,

I am trying to run Swift for TensorFlow in a playground (notebook). The example I am interested in is the one found here

import TensorFlow

var matrix: Tensor<Float> = [[1,2], [3,4]]

let sum = matrix + matrix
print("Sum: \(sum)")

When attempting to add 2 Tensors together I get the following error:

Playground execution failed:
error: TensorFlow.playground:5:18: error: internal error generating TensorFlow graph:
GraphGen cannot lower a 'send' to the host yet
let sum = matrix + matrix
                 ^

Also, I highlight this issue here
It appears to me that I am following the documentation exactly, unless I am missing something...Does anyone have any suggestions as to why this is happening?

UPDATE:
There is a workaround for this highlighted here

While this workaround "works" it doesn't seem like the "right" solution...just wanted to raise this issue in the proper place

Note: Swift for TensorFlow Development Snapshot 2018-04-26

Couldn't lookup symbols:_swift_FORCE_LOAD_$_swiftGlibc

Using in Linux:

swift -I /opt/usr/lib/swift/clang/include/
Welcome to Swift version 4.2-dev (LLVM 04bdb56f3d, Clang b44dbbdf44, Swift 70260a59ef). Type :help for assistance.
  1> import TensorFlow
error: Couldn't lookup symbols:
  _swift_FORCE_LOAD_$_swiftGlibc

or
test.swift

import TensorFlow
var x = Tensor<Float>([[1, 2], [3, 4]])

then:

swift test.swift 
test.swift:3:24: error: array input is not a constant array of tensors
var x = Tensor<Float>([[1, 2], [3, 4]])

swift -O test.swift
<unknown>:0: error: could not load the swift standard library

Thanks

Compiling Parameterized struct results in Abort trap: 6

Source attached.

Compilation results:

/Users/Shared/Development/Projects/TensorFlow/TFTests/TFTests/Test.swift:23:7: warning: initialization of immutable value 'w1' was never used; consider replacing with assignment to '_' or removing it
                let w1 = Tensor<Float64>(randomUniform: [4, 4, 3, 8])
                ~~~~^~
                _
/Users/Shared/Development/Projects/TensorFlow/TFTests/TFTests/Test.swift:42:9: warning: immutable value 'yPredicted' was never used; consider replacing with '_' or removing it
                        let (yPredicted, loss, gradients) = evaluateCost(x: x, y: y)
                             ^~~~~~~~~~
                             _
Assertion failed: (loc.isValid() && "Diagnosing attribute with invalid location"), function diagnoseAndRemoveAttr, file /usr/local/src/swift-build/swift/lib/Sema/TypeCheckAttr.cpp, line 41.
0  swift                    0x000000010a168258 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x000000010a167497 llvm::sys::RunSignalHandlers() + 39
2  swift                    0x000000010a1688d2 SignalHandler(int) + 258
3  libsystem_platform.dylib 0x00007fff583b0f5a _sigtramp + 26
4  swift                    0x000000010a108876 llvm::FoldingSetBase::FindNodeOrInsertPos(llvm::FoldingSetNodeID const&, void*&) + 166
5  libsystem_c.dylib        0x00007fff5814e1ae abort + 127
6  libsystem_c.dylib        0x00007fff581161ac basename_r + 0
7  swift                    0x00000001077cd9ba void (anonymous namespace)::AttributeChecker::diagnoseAndRemoveAttr<swift::Diag<swift::DeclName, swift::AccessLevel>&, swift::DeclName, swift::AccessLevel>(swift::DeclAttribute*, swift::Diag<swift::DeclName, swift::AccessLevel>&&&, swift::DeclName&&, swift::AccessLevel&&) + 234
8  swift                    0x00000001077c6b17 swift::ASTVisitor<(anonymous namespace)::AttributeChecker, void, void, void, void, void, void>::visit(swift::DeclAttribute*) + 5447
9  swift                    0x00000001077c55b1 swift::TypeChecker::checkDeclAttributes(swift::Decl*) + 49
10 swift                    0x000000010780d460 (anonymous namespace)::DeclChecker::visitStructDecl(swift::StructDecl*) + 144
11 swift                    0x0000000107800595 (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 1381
12 swift                    0x0000000107800026 swift::TypeChecker::typeCheckDecl(swift::Decl*) + 38
13 swift                    0x00000001078979ec typeCheckFunctionsAndExternalDecls(swift::SourceFile&, swift::TypeChecker&) + 1420
14 swift                    0x0000000107898823 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) + 2179
15 swift                    0x00000001074b3b12 swift::CompilerInstance::parseAndCheckTypesUpTo(swift::CompilerInstance::ImplicitImports const&, swift::SourceFile::ASTStage_t) + 866
16 swift                    0x00000001074b2e79 swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 505
17 swift                    0x000000010684a43e performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 1278
18 swift                    0x0000000106848ecf swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2943
19 swift                    0x00000001067fd0c8 main + 1128
20 libdyld.dylib            0x00007fff580a2015 start + 1
Stack dump:
0.	Program arguments: /Library/Developer/Toolchains/swift-tensorflow-DEVELOPMENT-2018-08-15-a.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/Shared/Development/Projects/TensorFlow/TFTests/TFTests/Test.swift -emit-module-path /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/Objects-normal/x86_64/Test~partial.swiftmodule -emit-module-doc-path /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/Objects-normal/x86_64/Test~partial.swiftdoc -serialize-diagnostics-path /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/Objects-normal/x86_64/Test.dia -emit-dependencies-path /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/Objects-normal/x86_64/Test.d -emit-reference-dependencies-path /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/Objects-normal/x86_64/Test.swiftdeps -target x86_64-apple-macosx10.13 -enable-objc-interop -sdk /Developer/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Products/Debug -F /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Products/Debug -enable-testing -g -module-cache-path /Users/davef/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 4.2 -O -D DEBUG -serialize-debugging-options -Xcc -working-directory -Xcc /Users/Shared/Development/Projects/TensorFlow/TFTests -Xcc -I/Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/TFTests-generated-files.hmap -Xcc -I/Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/TFTests-own-target-headers.hmap -Xcc -I/Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/TFTests-all-target-headers.hmap -Xcc -iquote -Xcc /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/TFTests-project-headers.hmap -Xcc -I/Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Products/Debug/include -Xcc -I/Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/DerivedSources/x86_64 -Xcc -I/Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/DerivedSources -Xcc -DDEBUG=1 -parse-as-library -module-name TFTests -o /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/Objects-normal/x86_64/Test.o 
1.	While type-checking 'Parameters' in module 'TFTests'

Test.swift.zip

No such module ‚TensorFlow‘

With Xode 10 (Beta 3) and toolchains
swift-tensorflow-DEVELOPMENT-2018-06-29-a-osx.pkg and
swift-tensorflow-DEVELOPMENT-2018-07-12-a-osx.pkg
I get an error when trying to import TensorFlow into a Command Line project:

No such module ‚TensorFlow‘

In playground and Swift REPL everything is working fine:

Welcome to Swift version 4.2-dev (LLVM eb00ef6046, Clang d9545f2833, Swift 3d37ae7c06). Type :help for assistance.
  1> import TensorFlow
  2>  

When using Xode 9.4.1 and toolchain swift-tensorflow-DEVELOPMENT-2018-06-25-a-osx.pkg an import of TensorFlow into a Command Line project is possible.

Environment:
macOS 10.13.6

error: internal error generating TensorFlow graph: GraphGen cannot lower a 'send' to the host yet

Using the code below (examples from swift-TF):

import Foundation

import TensorFlow

struct MLPClassifier {
    let w1 = Tensor<Float>(shape: [2, 4], repeating: 0.1)
    let w2 = Tensor<Float>(shape: [4, 1], scalars: [0.4, -0.5, -0.5, 0.4])
    let b1 = Tensor<Float>([0.2, -0.3, -0.3, 0.2])
    let b2 = Tensor<Float>([[0.4]])

    func prediction(for x: Tensor<Float>) -> Tensor<Float> {
        // The ⊗ operator performs matrix multiplication.
        let o1 = tanh(x ⊗ w1 + b1)
        return tanh(o1 ⊗ w2 + b2)
    }

    func multiply(_ x: Tensor<Float>) -> Tensor<Float> {
      return x ⊗ w1 + b1
    }
}

let input = Tensor<Float>([[0.2, 0.8]])
let classifier = MLPClassifier()
print(classifier.prediction(for: input))
print(classifier.prediction(for: input)) //Added here on purpose.

if the line 'print(classifier.prediction(for: input))' is duplicated, the compilation fails with " error: internal error generating TensorFlow graph: GraphGen cannot lower a 'send' to the host yet"

Q: What does mean this error message, and how to work around it?

thanks

trying to use with carthage

Module compiled with Swift 4.1.2 cannot be imported by the Swift 4.2 compiler: /Users/jpope/Documents/gitWorkspace/Bresenham-Line/Carthage/Build/Mac/EasyImagy.framework/Modules/EasyI

screen shot 2018-08-29 at 12 18 03 pm

not an issue - thoughts on swift matrix helpers / math libraries / Numeric operator overloading

I'm porting some python code and bumping up with some tech spike around some trivial matrix ops.

eg.

   env_low = env.observation_space.low // Array 
    env_high = env.observation_space.high // Array 
    env_dx = (env_high - env_low) / n_states // divide array of floats by float - return new array

to swift / here's some code that will coerce a numpy array to native swift array.

import Python

extension Array where Element == UInt8 {
    
    public init?(numpyArray: PythonObject) {
        /*
        guard let np = try? Python.attemptImport("numpy") else {
            return nil
        }
    
        guard Python.isinstance(numpyArray, np.ndarray) == 1 else {
            return nil
        }
        
        let numpyArray = numpyArray.astype(np.uint8)*/
        let numpyArraySize = Int(numpyArray.size)!
        let numpyArrayPointerAddress = UInt(numpyArray.__array_interface__["data"].tuple2.0)!
        let pointer = UnsafePointer<Element>(bitPattern: numpyArrayPointerAddress)!
        let bufferPointer = UnsafeBufferPointer(start: pointer, count: numpyArraySize)
        self.init(bufferPointer)
    }
}

// agnostic helper to subtract arrays - allowing  (env_high - env_low) 
func - <Element: Hashable>(lhs: [Element], rhs: [Element]) -> [Element]
{
    return Array(Set<Element>(lhs).subtracting(Set<Element>(rhs)))
}

but then using
subtract / multiply / divide etc - is not so straightforward. I'm not looking to do tensorflow ops on the graph - just some data wrangling.

Using a swift library like surge - I can get first class operations on matrices using accelerate framework
https://github.com/mattt/Surge

Arithmetic /sum /asum/ max / min / mean / meamg / measq etc
https://github.com/mattt/Surge/blob/master/Sources/Surge/Arithmetic.swift

although the linux users would obviously have reservations with any specific osx code.
So enter numpy ->
numpy for swift may seem like a good answer - but interfacing with it is a bit of black box (without code completion). maybe some documentation could be built around this and backfilled into code completion??

I found this library by @sonsongithub which seems like an attempted swift numpy port
https://github.com/sonsongithub/numsw/tree/master/Sources/numsw/Matrix

related
https://github.com/mattt/Surge/issues/85

perhaps there's no we should use this / or that - as community will rally to build out the tools in due course - maybe it's a case of getting behind Surge to provide a shim for linux users which would run without the acceleration (4000 times slower). @mattt - do you have any thoughts?

or is there something I'm missing?

To add to discourse - in any third party framework - getting these to work with terminal app with frameworks is not so trivial. so there's that to consider. JohnSundell/Marathon#186

standalone Python.swift module?

Hello,

In the PythonInteroperability.md document, you write

Another interesting aspect of this work is that Python support is completely independent of the other TensorFlow and automatic differentiation logic we’re building as part of Swift for TensorFlow. This is a generally useful extension to the Swift ecosystem that can stand alone, useful for server side development or anything else that wants to interoperate with existing Python APIs.

I totally agree, and it would be nice if the Python.swift module could be available on its own independently of TensorFlow, to use for other applications that need to call into Python code.

I came across this, https://github.com/pvieito/PythonKit, which seems to be using the same code, though I am not sure what is its relation with the tensorflow/swift project, if any.

Have you considered making it available in a separate repository with its own Package.swift, etc.?

Thank you.

Simplest example compilation error

I tried to run in Playground first code example mentioned here:
https://github.com/tensorflow/swift/blob/master/Usage.md

import TensorFlow

let x = Tensor([[1, 2], [3, 4]])
print(x)

An got this error:

note: overloads for 'Tensor<_>' exist with these partially matching parameter lists: (Tensor<Bool>), (ShapedArray<Scalar>), (Tensor<OtherScalar>), (Scalar), ([Tensor<Scalar>]), ([Scalar]), (C)
let x = Tensor([[1, 2], [3, 4]])

XCode 9.3, MacOS 10.13.4
Toolchain swift-tensorflow-DEVELOPMENT-2018-05-10-a-osx.pkg

TensorFlow doesn't work in REPL, Playground and macOS App

Hello! I have problem. I setup latest swift-tensorflow-DEVELOPMENT-2018-05-10-a.xctoolchain, used export PATH=/Library/Developer/Toolchains/swift-latest/usr/bin:"${PATH}" and select on 'Swift for TensorFlow Development Snapshot' and nothing.

My macOS Playground don't compile:
image

MacOS Cocoa App has crashes:
image

And REPL can't find TensorFlow Module:
image

That my toolchains:
image

And env:
image

What I do wrong? Except programming, of course..

Compiler crash associated with uninitialized variables

Here is some sample code I attempted to compile. The code has a bug where I failed to assign a value to the activation parameter. Instead of giving me an error, the compiler crashes (details below).

import TensorFlow

func identity(_ a : Tensor<Float>) -> Tensor<Float> {
   return a
}

struct DenseLayer : Parameterized {
   @TFParameter var w: Tensor<Float>
   @TFParameter var b: Tensor<Float>
   var activation: (Tensor<Float>) -> Tensor<Float>
   
   init(inputSize: Int32, outputSize: Int32, activation : (Tensor<Float>) -> Tensor<Float> = identity) {
       w = Tensor(zeros: [inputSize, outputSize])
       b = Tensor(zeros: [outputSize])
   }
   
   func forward(_ input : Tensor<Float>) -> Tensor<Float>{
       return activation(input • w + b)
   }
}

I am running on Jupyter hosted in docker, using the instructions from this tutorial.

When I attempt to compile the above code, my Jupyter kernel crashes with the following error message:

python: /home/swift-build/swift/lib/SILOptimizer/Transforms/SILMem2Reg.cpp:476: void (anonymous namespace)::MemoryToRegisters::removeSingleBlockAllocation(swift::AllocStackInst *): Assertion `ASI->getElementType().isVoid() && "Expected initialization of non-void type!"' failed.
Stack dump:
0.      While running pass #356 SILModuleTransform "TFDeabstraction".
1.      TFDeabstraction on function $S13__lldb_expr_710DenseLayerV9inputSize06outputF010activationACs5Int32V_AH10TensorFlow0J0VySfGALXEtcfC
2.      PromotableMemoryFinder::promoteToSSA

Weird bugs in working with ParameterAggregate

OS: macOS Mojava Beta
Toolchain: Xcode 10/7-24

I found if I:
1). use update method of ParameterAggregate;
2). print some tensor related information in each iteration;

the program will frozen after 1 or 2 times iteration during the execution, or sometime will cause to compilation error which message is "#tfop invalid: FIXME: cannot lower a Host->TF tensor transfer in a loop header"

Remove print or update fix the problem. (matmul or • works fine with print )

sometimes print(loss) works fine but print("\(loss)") will trigger compilation error above.

Test code:

struct Weights : ParameterAggregate {
    var w = Tensor<Float>([[1,2],[3,4]])
}

func train_test(_ x : inout Weights)
{
    for i in 0...3
    {
        let grad = Weights()
        x.update(withGradients : grad){ (p,g) in 
            p = g * 0.0001
        }
        print(i)
        let result = x.w.mean()
        print(result)
    }
}

var weight = Weights()
train_test(&weight)

xcode 9.3 code signature verification fails

When I try to verify the code-signature of the swift/TF toolchain, I get an error saying:

“Swift for TensorFlow Development Snapshot 2018-05-03” does not have a valid signature: code failed to satisfy specified code requirement(s)

See image below

image

Any idea how I can resolve this?

Question: is the precondition on init(shape:scalars:) meant to be permanent?

Hello,
this may be not a genuine TF question, but just for my information, I've noticed that

let w2 = Tensor<Float>(shape: [N, N], scalars: giveMeAnArrayNxN(N))

won't compile, which I think relates to the initialiser design here:

https://www.tensorflow.org/api_docs/swift/Structs/Tensor#initshapescalars

i.e. there's a precondition on the [Scalar] size. In other words, it looks like the code snipet is never going to work, since giveMeAnArrayNxN() returns [Scalar].

What would be your recommendation? Any hopes to dynamically allocate Tensors? I'm not too keen to using the other initialiser (init(shape: TensorShape, scalars: UnsafeBufferPointer), which seems to have the same precondition anyway)

Sorry, just giving tensorflow/swift a test drive, my question might look stupid to the experts.

REPL, multiarray.x86_64-linux-gnu.so: undefined symbol: PyExc_SystemError:

Environment:

  • Ubuntu 16.04.4 x86_64

REPL error log (While on CLion without REPL is OK):

➜  ~ export PATH=/home/iron/a/app/swift_dev/usr/bin:$PATH
➜  ~ swift -I/home/iron/a/app/swift_dev/usr/lib/swift/clang/include
Welcome to Swift version 4.2-dev (LLVM 04bdb56f3d, Clang b44dbbdf44, Swift 70260a59ef). Type :help for assistance.
  1> let a = 2
a: Int = 2
  2> let b = 3
b: Int = 3
  3> a*3
$R0: Int = 6
  4> import Python
  5> let np = Python.import("numpy")
Fatal error: 'try!' expression unexpectedly raised an error: exception: /usr/lib/python2.7/dist-packages/numpy/core/multiarray.x86_64-linux-gnu.so: undefined symbol: PyExc_SystemError: file /home/swift-build/swift/stdlib/public/core/ErrorType.swift, line 184
Current stack trace:
0    libswiftCore.so                    0x00007ffff2107110 _swift_stdlib_reportFatalErrorInFile + 215
1    libswiftCore.so                    0x00007ffff20a9627 <unavailable> + 4269607
2    libswiftCore.so                    0x00007ffff1e2204d <unavailable> + 1617997
3    libswiftCore.so                    0x00007ffff20a94bd <unavailable> + 4269245
4    libswiftCore.so                    0x00007ffff20a9427 <unavailable> + 4269095
5    libswiftCore.so                    0x00007ffff1e228a8 <unavailable> + 1620136
6    libswiftCore.so                    0x00007ffff20a93d0 <unavailable> + 4269008
7    libswiftCore.so                    0x00007ffff1e2204d <unavailable> + 1617997
8    libswiftCore.so                    0x00007ffff1fe3c98 <unavailable> + 3460248
9    libswiftCore.so                    0x00007ffff1eb0fca <unavailable> + 2203594
np: Python.PythonObject =terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid
[1]    16294 abort (core dumped)  swift -I/home/iron/a/app/swift_dev/usr/lib/swift/clang/include

error: failed to launch REPL process: process launch failed: unable to locate debugserver

$ export PATH=/Library/Developer/Toolchains/swift-latest/usr/bin:"${PATH}"

$ swift
error: failed to launch REPL process: process launch failed: unable to locate debugserver

$ cd /Library/Developer/Toolchains/swift-latest/usr/bin
$ ls
lldb			swift-autolink-extract	swift-demangle		swift-run		swiftc
lldb-mi			swift-build		swift-format		swift-stdlib-tool
swift			swift-build-tool	swift-package		swift-test

$ ./swift
error: failed to launch REPL process: process launch failed: unable to locate debugserver

show the "verify code signature"

“Swift for TensorFlow Development Snapshot 2018-04-26” does not have a valid signature: code failed to satisfy specified code requirement(s)

swift CLI and xcode gives contradict results

screen shot 2018-04-27 at 8 22 18 pm

I followed the Mac install instructions and configured xcode to use TF toolchain instead of the default one.

screen shot 2018-04-27 at 8 22 08 pm

However, I'm not able to compile and run the code within xcode.

I can run it using the CLI tool though
swift -O main.swift
[[0.680704]]

Any thoughts on what could be the root cause?

Here is the current environment setting
$ ls -l /Library/Developer/Toolchains/
total 0
lrwxr-xr-x 1 root wheel 83 Apr 27 19:53 swift-latest -> /Library/Developer/Toolchains/swift-tensorflow-DEVELOPMENT-2018-04-26-a.xctoolchain
drwxr-xr-x 7 root wheel 224 Apr 27 19:53 swift-tensorflow-DEVELOPMENT-2018-04-26-a.xctoolchain

$ env
PATH=/Library/Developer/Toolchains/swift-latest/usr/bin:/Users/wangtz/Downloads/google-cloud-sdk/bin:/Users/wangtz/.opam/4.02.3+buckle-master/bin:/Users/wangtz/homebrew/bin:/Users/wangtz/bin:/usr/local/share/python:/usr/local/git/current/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/go/bin:/opt/X11/bin

Thanks!

numpy broadcast NotImplemented in Swift 4.2

Environment:

Ubuntu 16.04
swift --version
Swift version 4.2-dev (LLVM 04bdb56f3d, Clang b44dbbdf44, Swift aa19e11af7)

Source:

import Python
let np = Python.import("numpy")
let a = np.arange.call(with: 15).reshape.call(with: 3, 5)
print(a)

let c = 2 * a
print(c)

Output:

[[ 0  1  2  3  4]
 [ 5  6  7  8  9]
 [10 11 12 13 14]]
NotImplemented

Adding depencies to Swift for TensorFlow Project

Hello,

I am attempting to add Vapor as a dependecy to a Project that uses the Swift for TensorFlow Development Snapshot. I am using this starter project

my Package.swift is as follows:

// swift-tools-version:4.0

import PackageDescription

let package = Package(
    name: "STSProject",
    products: [
        .library(
            name: "STSLibrary",
            type: .dynamic,
            targets: ["STSLibrary"]
        )
    ],
    dependencies: [
	.package(url: "https://github.com/vapor/vapor.git", from: "3.0.0"),
    ],
    targets: [
        .target(
            name: "STSLibrary",
            dependencies: ["Vapor"]),
        .target(
            name: "STSApplication",
            dependencies: ["STSLibrary"]),
        .testTarget(
            name: "STSLibraryTests",
            dependencies: ["STSLibrary"]),
    ]
)

Upon building the project I get the following error:
Command /Library/Developer/Toolchains/swift-tensorflow-DEVELOPMENT-2018-04-26-a.xctoolchain/usr/bin/swiftc failed with exit code 1

I can confirm that I get the same error is present in a Non-STS starter project

This issue seems to be isolated to the version of Swift/Swift Tools being used, which is the Development Snapshot for TensorFlow. This might be a low priority, just thought I should raise the issue here. If more context is needed please let me know.

Thank you

Assertion Failed in #gradient call with latest toolchain(8-31)

My Code:

import TensorFlow

func test(_ x : Float) -> Float
{
    return x * x
}

func main() -> Void
{
    print(test(10))
    let dtest = #gradient(test)
    print(dtest(20))
}

main()
Assertion failed: (adjoint && "Adjoint does not exist?"), function fillCanonicalGradient, file /usr/local/src/swift-build/swift/lib/SILOptimizer/Mandatory/TFDifferentiation.cpp, line 2757.
0  swift                    0x000000010acc06d8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x000000010acbf917 llvm::sys::RunSignalHandlers() + 39
2  swift                    0x000000010acc0d52 SignalHandler(int) + 258
3  libsystem_platform.dylib 0x00007fff6b286c9d _sigtramp + 29
4  libsystem_platform.dylib 0x0000000000000005 _sigtramp + 2497155973
5  libsystem_c.dylib        0x00007fff6b1471c9 abort + 127
6  libsystem_c.dylib        0x00007fff6b10f868 basename_r + 0
7  swift                    0x0000000107d66518 (anonymous namespace)::Differentiation::run() + 22536
8  swift                    0x0000000107e02e9a swift::SILPassManager::runModulePass(unsigned int) + 346
9  swift                    0x0000000107e03827 swift::SILPassManager::execute() + 759
10 swift                    0x0000000107535bdb swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) + 187
11 swift                    0x0000000107e0b914 swift::runSILDiagnosticPasses(swift::SILModule&) + 132
12 swift                    0x00000001073cac07 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 13079
13 swift                    0x00000001073c6878 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2936
14 swift                    0x00000001073805b8 main + 1128
15 libdyld.dylib            0x00007fff6b09f091 start + 1
Stack dump:
0.	Program arguments: /Library/Developer/Toolchains/swift-tensorflow-DEVELOPMENT-2018-07-24-a.xctoolchain/usr/bin/swift -frontend -interpret adtest.swift -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -O -color-diagnostics -module-name adtest
1.	While running pass #78 SILModuleTransform "Differentiation".
[1]    12686 abort       -O adtest.swift

Import error.

Reinstalled several times, but Xcode constantly gives import error. It is impossible to import "TensorFlow", but for some reason sometimes "CTensorFlow" is suggested by Xcode suggestions.
2018-06-06 10 07 42

Also, in some cases playground just goes in infinite compilation, or works very very slow. What this could be caused by and how may I solve this problems?
Thanks in advance.

Xcode 9.4
macOS 10.13.5

support for cocoa app

I'm capturing this bug here and understand swift + tensorflow is currently alpha and supporting a cocoa app is on the back log.

However, I do want to help out, and you may not be aware of this crash - so submitting the attached repo
(this includes terminal line / cocoa app)
one is working / the other isn't.
There’s an appdelegate
And import of some tensorflow code.

The code could be simpler but stumped at what’s going wrong.
https://github.com/johndpope/SwiftReinforce/tree/cocoa-app

Side note -
My need for cocoa app is to be able to render interact with images for gym atari.
And hopefully interact with easyImagy framework / this isn’t so straightforward with terminal apps.
Although there maybe a workaround using
let image = Python.import("PIL.Image")
https://github.com/johndpope/SwiftReinforce/blob/cocoa-app/SwiftReinforce/Common/Utilities.swift#L27

                                                          ~~~~~~~~~~~~^~~~~
!dbg attachment points at wrong subprogram for function
!695 = distinct !DISubprogram(name: "train", linkageName: "$S17SwiftReinforceApp5ModelV5train12observations7actions7rewards9batchSizeySays5Int32VG_AKSaySfGSitF", scope: !412, file: !5, line: 69, type: !696, isLocal: false, isDefinition: true, scopeLine: 69, isOptimized: false, unit: !0, variables: !2)
void (%swift.bridge*, %swift.bridge*, %swift.bridge*, i64, %T17SwiftReinforceApp5ModelV*)* @"$S17SwiftReinforceApp5ModelV5train12observations7actions7rewards9batchSizeySays5Int32VG_AKSaySfGSitF"
  store %swift.bridge* %1, %swift.bridge** %21, align 8, !dbg !740
!740 = !DILocation(line: 0, scope: !707)
!707 = distinct !DISubprogram(name: "train", linkageName: "$S17SwiftReinforceApp5ModelV5train12observations7actions7rewards9batchSizey10TensorFlow0K0VySfG_Says5Int32VGSaySfGSitF", scope: !412, file: !5, line: 81, type: !708, isLocal: false, isDefinition: true, scopeLine: 81, isOptimized: false, unit: !0, variables: !2)
!707 = distinct !DISubprogram(name: "train", linkageName: "$S17SwiftReinforceApp5ModelV5train12observations7actions7rewards9batchSizey10TensorFlow0K0VySfG_Says5Int32VGSaySfGSitF", scope: !412, file: !5, line: 81, type: !708, isLocal: false, isDefinition: true, scopeLine: 81, isOptimized: false, unit: !0, variables: !2)
!dbg attachment points at wrong subprogram for function
!910 = distinct !DISubprogram(name: "train", linkageName: "$S17SwiftReinforceApp5ModelV5train12observations7actions7rewards9batchSizeySaySfG_Says5Int32VGAISitF", scope: !412, file: !5, line: 74, type: !911, isLocal: false, isDefinition: true, scopeLine: 74, isOptimized: false, unit: !0, variables: !2)
void (%swift.bridge*, %swift.bridge*, %swift.bridge*, i64, %T17SwiftReinforceApp5ModelV*)* @"$S17SwiftReinforceApp5ModelV5train12observations7actions7rewards9batchSizeySaySfG_Says5Int32VGAISitF"
  store %T10TensorFlow0A6HandleCySfG* %92, %T10TensorFlow0A6HandleCySfG** %15, align 8, !dbg !740
!740 = !DILocation(line: 0, scope: !707)
!707 = distinct !DISubprogram(name: "train", linkageName: "$S17SwiftReinforceApp5ModelV5train12observations7actions7rewards9batchSizey10TensorFlow0K0VySfG_Says5Int32VGSaySfGSitF", scope: !412, file: !5, line: 81, type: !708, isLocal: false, isDefinition: true, scopeLine: 81, isOptimized: false, unit: !0, variables: !2)
!707 = distinct !DISubprogram(name: "train", linkageName: "$S17SwiftReinforceApp5ModelV5train12observations7actions7rewards9batchSizey10TensorFlow0K0VySfG_Says5Int32VGSaySfGSitF", scope: !412, file: !5, line: 81, type: !708, isLocal: false, isDefinition: true, scopeLine: 81, isOptimized: false, unit: !0, variables: !2)
!dbg attachment points at wrong subprogram for function
!1223 = distinct !DISubprogram(name: "predictAction", linkageName: "$S17SwiftReinforceApp5ModelV13predictActionys5Int32VSaySfGF", scope: !412, file: !5, line: 150, type: !1224, isLocal: false, isDefinition: true, scopeLine: 150, isOptimized: false, unit: !0, variables: !2)
i32 (%swift.bridge*, %T17SwiftReinforceApp5ModelV*)* @"$S17SwiftReinforceApp5ModelV13predictActionys5Int32VSaySfGF"
  store %T10TensorFlow0A6HandleCySfG* %41, %T10TensorFlow0A6HandleCySfG** %10, align 8, !dbg !1255
!1255 = !DILocation(line: 0, scope: !1231)
!1231 = distinct !DISubprogram(name: "predictAction", linkageName: "$S17SwiftReinforceApp5ModelV13predictActionys5Int32V10TensorFlow0H0VySfGF", scope: !412, file: !5, line: 162, type: !1232, isLocal: false, isDefinition: true, scopeLine: 162, isOptimized: false, unit: !0, variables: !2)
!1231 = distinct !DISubprogram(name: "predictAction", linkageName: "$S17SwiftReinforceApp5ModelV13predictActionys5Int32V10TensorFlow0H0VySfGF", scope: !412, file: !5, line: 162, type: !1232, isLocal: false, isDefinition: true, scopeLine: 162, isOptimized: false, unit: !0, variables: !2)
!dbg attachment points at wrong subprogram for function
!1470 = distinct !DISubprogram(name: "predictAction", linkageName: "$S17SwiftReinforceApp5ModelV13predictActionys5Int32VAFF", scope: !412, file: !5, line: 157, type: !1471, isLocal: false, isDefinition: true, scopeLine: 157, isOptimized: false, unit: !0, variables: !2)
i32 (i32, %T17SwiftReinforceApp5ModelV*)* @"$S17SwiftReinforceApp5ModelV13predictActionys5Int32VAFF"
  store %T10TensorFlow0A6HandleCySfG* %99, %T10TensorFlow0A6HandleCySfG** %16, align 8, !dbg !1255
!1255 = !DILocation(line: 0, scope: !1231)
!1231 = distinct !DISubprogram(name: "predictAction", linkageName: "$S17SwiftReinforceApp5ModelV13predictActionys5Int32V10TensorFlow0H0VySfGF", scope: !412, file: !5, line: 162, type: !1232, isLocal: false, isDefinition: true, scopeLine: 162, isOptimized: false, unit: !0, variables: !2)
!1231 = distinct !DISubprogram(name: "predictAction", linkageName: "$S17SwiftReinforceApp5ModelV13predictActionys5Int32V10TensorFlow0H0VySfGF", scope: !412, file: !5, line: 162, type: !1232, isLocal: false, isDefinition: true, scopeLine: 162, isOptimized: false, unit: !0, variables: !2)
<unknown>:0: error: fatal error encountered during compilation; please file a bug report with your project and the crash log
<unknown>:0: note: Broken module found, compilation aborted!
0  swift                    0x000000010eaabb18 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x000000010eaaad57 llvm::sys::RunSignalHandlers() + 39
2  swift                    0x000000010eaac192 SignalHandler(int) + 258
3  libsystem_platform.dylib 0x00007fff704fbb3d _sigtramp + 29
4  libsystem_platform.dylib 0x00007ffee4abf6a0 _sigtramp + 1952201600
5  libsystem_c.dylib        0x00007fff703ba1c9 abort + 127
6  swift                    0x000000010b191ace swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*)::$_1::__invoke(void*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) + 542
7  swift                    0x000000010ea4abdc llvm::report_fatal_error(llvm::Twine const&, bool) + 252
8  swift                    0x000000010ea4aadb llvm::report_fatal_error(char const*, bool) + 43
9  swift                    0x000000010e9fac54 (anonymous namespace)::VerifierLegacyPass::doFinalization(llvm::Module&) + 212
10 swift                    0x000000010e98a960 llvm::FPPassManager::doFinalization(llvm::Module&) + 80
11 swift                    0x000000010e98a0bb llvm::legacy::FunctionPassManagerImpl::doFinalization(llvm::Module&) + 107
12 swift                    0x000000010b2f1ff8 swift::performLLVMOptimizations(swift::IRGenOptions&, llvm::Module*, llvm::TargetMachine*) + 1176
13 swift                    0x000000010b2f2d0c swift::performLLVM(swift::IRGenOptions&, swift::DiagnosticEngine*, llvm::sys::SmartMutex<false>*, llvm::GlobalVariable*, llvm::Module*, llvm::TargetMachine*, swift::version::Version const&, llvm::StringRef, swift::UnifiedStatsReporter*) + 2028
14 swift                    0x000000010b191456 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 17014
15 swift                    0x000000010b18c16f swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2943
16 swift                    0x000000010b140368 main + 1128
17 libdyld.dylib            0x00007fff703120a1 start + 1
Stack dump:
0.	Program arguments: /Library/Developer/Toolchains/swift-tensorflow-DEVELOPMENT-2018-09-05-a.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/jpope/Documents/tensorflowWorkspace/SwiftReinforce/SwiftReinforce/Common/Model.swift /Users/jpope/Documents/tensorflowWorkspace/SwiftReinforce/SwiftReinforce/Runner/FrozenLakeRunner.swift /Users/jpope/Documents/tensorflowWorkspace/SwiftReinforce/SwiftReinforce/Common/StatsRecorder.swift /Users/jpope/Documents/tensorflowWorkspace/SwiftReinforce/SwiftReinforce/Runner/CartPoleRunner.swift /Users/jpope/Documents/tensorflowWorkspace/SwiftReinforce/SwiftReinforce/Runner/MainRunner.swift /Users/jpope/Documents/tensorflowWorkspace/SwiftReinforce/SwiftReinforce/Common/Array+NumPy.swift /Users/jpope/Documents/tensorflowWorkspace/SwiftReinforce/SwiftReinforce/Common/Utilities.swift /Users/jpope/Documents/tensorflowWorkspace/SwiftReinforce/Test/AppDelegate.swift /Users/jpope/Documents/tensorflowWorkspace/SwiftReinforce/SwiftReinforce/Runner/PongRunner.swift -emit-module-path /Users/jpope/Library/Developer/Xcode/DerivedData/SwiftReinforce-bzxtikxdhqircyfakrayvesupdwi/Build/Intermediates.noindex/SwiftReinforce.build/Debug/SwiftReinforceApp.build/Objects-normal/x86_64/Model~partial.swiftmodule -emit-module-doc-path /Users/jpope/Library/Developer/Xcode/DerivedData/SwiftReinforce-bzxtikxdhqircyfakrayvesupdwi/Build/Intermediates.noindex/SwiftReinforce.build/Debug/SwiftReinforceApp.build/Objects-normal/x86_64/Model~partial.swiftdoc -serialize-diagnostics-path /Users/jpope/Library/Developer/Xcode/DerivedData/SwiftReinforce-bzxtikxdhqircyfakrayvesupdwi/Build/Intermediates.noindex/SwiftReinforce.build/Debug/SwiftReinforceApp.build/Objects-normal/x86_64/Model.dia -emit-dependencies-path /Users/jpope/Library/Developer/Xcode/DerivedData/SwiftReinforce-bzxtikxdhqircyfakrayvesupdwi/Build/Intermediates.noindex/SwiftReinforce.build/Debug/SwiftReinforceApp.build/Objects-normal/x86_64/Model.d -emit-reference-dependencies-path /Users/jpope/Library/Developer/Xcode/DerivedData/SwiftReinforce-bzxtikxdhqircyfakrayvesupdwi/Build/Intermediates.noindex/SwiftReinforce.build/Debug/SwiftReinforceApp.build/Objects-normal/x86_64/Model.swiftdeps -target x86_64-apple-macosx10.14 -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I /Users/jpope/Library/Developer/Xcode/DerivedData/SwiftReinforce-bzxtikxdhqircyfakrayvesupdwi/Build/Products/Debug -F /Users/jpope/Library/Developer/Xcode/DerivedData/SwiftReinforce-bzxtikxdhqircyfakrayvesupdwi/Build/Products/Debug -enable-testing -g -module-cache-path /Users/jpope/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 4.2 -enforce-exclusivity=checked -Onone -D DEBUG -serialize-debugging-options -Xcc -working-directory -Xcc /Users/jpope/Documents/tensorflowWorkspace/SwiftReinforce -Xcc -I/Users/jpope/Library/Developer/Xcode/DerivedData/SwiftReinforce-bzxtikxdhqircyfakrayvesupdwi/Build/Intermediates.noindex/SwiftReinforce.build/Debug/SwiftReinforceApp.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/jpope/Library/Developer/Xcode/DerivedData/SwiftReinforce-bzxtikxdhqircyfakrayvesupdwi/Build/Intermediates.noindex/SwiftReinforce.build/Debug/SwiftReinforceApp.build/SwiftReinforceApp-generated-files.hmap -Xcc -I/Users/jpope/Library/Developer/Xcode/DerivedData/SwiftReinforce-bzxtikxdhqircyfakrayvesupdwi/Build/Intermediates.noindex/SwiftReinforce.build/Debug/SwiftReinforceApp.build/SwiftReinforceApp-own-target-headers.hmap -Xcc -I/Users/jpope/Library/Developer/Xcode/DerivedData/SwiftReinforce-bzxtikxdhqircyfakrayvesupdwi/Build/Intermediates.noindex/SwiftReinforce.build/Debug/SwiftReinforceApp.build/SwiftReinforceApp-all-target-headers.hmap -Xcc -iquote -Xcc /Users/jpope/Library/Developer/Xcode/DerivedData/SwiftReinforce-bzxtikxdhqircyfakrayvesupdwi/Build/Intermediates.noindex/SwiftReinforce.build/Debug/SwiftReinforceApp.build/SwiftReinforceApp-project-headers.hmap -Xcc -I/Users/jpope/Library/Developer/Xcode/DerivedData/SwiftReinforce-bzxtikxdhqircyfakrayvesupdwi/Build/Products/Debug/include -Xcc -I/Users/jpope/Library/Developer/Xcode/DerivedData/SwiftReinforce-bzxtikxdhqircyfakrayvesupdwi/Build/Intermediates.noindex/SwiftReinforce.build/Debug/SwiftReinforceApp.build/DerivedSources/x86_64 -Xcc -I/Users/jpope/Library/Developer/Xcode/DerivedData/SwiftReinforce-bzxtikxdhqircyfakrayvesupdwi/Build/Intermediates.noindex/SwiftReinforce.build/Debug/SwiftReinforceApp.build/DerivedSources -Xcc -DDEBUG=1 -module-name SwiftReinforceApp -o /Users/jpope/Library/Developer/Xcode/DerivedData/SwiftReinforce-bzxtikxdhqircyfakrayvesupdwi/Build/Intermediates.noindex/SwiftReinforce.build/Debug/SwiftReinforceApp.build/Objects-normal/x86_64/Model.o -index-store-path /Users/jpope/Library/Developer/Xcode/DerivedData/SwiftReinforce-bzxtikxdhqircyfakrayvesupdwi/Index/DataStore -index-system-modules 

enhancement - generative model sample code / gan zoo

to foster community involvement - some richer sample code beyond MNIST should be tackled.
Generative Adversarial Networks is a hot topic amongst ML - and some sample code using swift should help encourage researchers to pick up swift / a list of GAN projects attached below.

thinking out loud - consider google swift team - could have a budget with bounties that community could vote on and award to spur development ahead.

python reference -
https://github.com/hwalsuklee/tensorflow-generative-model-collections

https://github.com/hindupuravinash/the-gan-zoo

3D-ED-GAN - Shape Inpainting using 3D Generative Adversarial Network and Recurrent Convolutional Networks
3D-GAN - Learning a Probabilistic Latent Space of Object Shapes via 3D Generative-Adversarial Modeling (github)
3D-IWGAN - Improved Adversarial Systems for 3D Object Generation and Reconstruction (github)
3D-RecGAN - 3D Object Reconstruction from a Single Depth View with Adversarial Learning (github)
ABC-GAN - ABC-GAN: Adaptive Blur and Control for improved training stability of Generative Adversarial Networks (github)
ABC-GAN - GANs for LIFE: Generative Adversarial Networks for Likelihood Free Inference
AC-GAN - Conditional Image Synthesis With Auxiliary Classifier GANs
acGAN - Face Aging With Conditional Generative Adversarial Networks
ACGAN - Coverless Information Hiding Based on Generative adversarial networks
ACtuAL - ACtuAL: Actor-Critic Under Adversarial Learning
AdaGAN - AdaGAN: Boosting Generative Models
AdvGAN - Generating adversarial examples with adversarial networks
AE-GAN - AE-GAN: adversarial eliminating with GAN
AEGAN - Learning Inverse Mapping by Autoencoder based Generative Adversarial Nets
AF-DCGAN - AF-DCGAN: Amplitude Feature Deep Convolutional GAN for Fingerprint Construction in Indoor Localization System
AffGAN - Amortised MAP Inference for Image Super-resolution
AL-CGAN - Learning to Generate Images of Outdoor Scenes from Attributes and Semantic Layouts
ALI - Adversarially Learned Inference (github)
AlignGAN - AlignGAN: Learning to Align Cross-Domain Images with Conditional Generative Adversarial Networks
AM-GAN - Activation Maximization Generative Adversarial Nets
AmbientGAN - AmbientGAN: Generative models from lossy measurements (github)
AnoGAN - Unsupervised Anomaly Detection with Generative Adversarial Networks to Guide Marker Discovery
APE-GAN - APE-GAN: Adversarial Perturbation Elimination with GAN
ARAE - Adversarially Regularized Autoencoders for Generating Discrete Structures (github)
ARDA - Adversarial Representation Learning for Domain Adaptation
ARIGAN - ARIGAN: Synthetic Arabidopsis Plants using Generative Adversarial Network
ArtGAN - ArtGAN: Artwork Synthesis with Conditional Categorial GANs
ATA-GAN - Attention-Aware Generative Adversarial Networks (ATA-GANs)
Attention-GAN - Attention-GAN for Object Transfiguration in Wild Images
AttGAN - Arbitrary Facial Attribute Editing: Only Change What You Want (github)
AttnGAN - AttnGAN: Fine-Grained Text to Image Generation with Attentional Generative Adversarial Networks (github)
B-DCGAN - B-DCGAN:Evaluation of Binarized DCGAN for FPGA
b-GAN - Generative Adversarial Nets from a Density Ratio Estimation Perspective
BAGAN - BAGAN: Data Augmentation with Balancing GAN
Bayesian GAN - Deep and Hierarchical Implicit Models
Bayesian GAN - Bayesian GAN (github)
BCGAN - Bayesian Conditional Generative Adverserial Networks
BCGAN - Bidirectional Conditional Generative Adversarial networks
BEGAN - BEGAN: Boundary Equilibrium Generative Adversarial Networks
BGAN - Binary Generative Adversarial Networks for Image Retrieval (github)
BicycleGAN - Toward Multimodal Image-to-Image Translation (github)
BiGAN - Adversarial Feature Learning
BranchGAN - Branched Generative Adversarial Networks for Multi-Scale Image Manifold Learning
BS-GAN - Boundary-Seeking Generative Adversarial Networks
C-GAN - Face Aging with Contextual Generative Adversarial Nets
C-RNN-GAN - C-RNN-GAN: Continuous recurrent neural networks with adversarial training (github)
CA-GAN - Composition-aided Sketch-realistic Portrait Generation
CaloGAN - CaloGAN: Simulating 3D High Energy Particle Showers in Multi-Layer Electromagnetic Calorimeters with Generative Adversarial Networks (github)
CAN - CAN: Creative Adversarial Networks, Generating Art by Learning About Styles and Deviating from Style Norms
CapsuleGAN - CapsuleGAN: Generative Adversarial Capsule Network
CatGAN - Unsupervised and Semi-supervised Learning with Categorical Generative Adversarial Networks
CatGAN - CatGAN: Coupled Adversarial Transfer for Domain Generation
CausalGAN - CausalGAN: Learning Causal Implicit Generative Models with Adversarial Training
CC-GAN - Semi-Supervised Learning with Context-Conditional Generative Adversarial Networks (github)
CDcGAN - Simultaneously Color-Depth Super-Resolution with Conditional Generative Adversarial Network
CFG-GAN - Composite Functional Gradient Learning of Generative Adversarial Models
CGAN - Conditional Generative Adversarial Nets
CGAN - Controllable Generative Adversarial Network
Chekhov GAN - An Online Learning Approach to Generative Adversarial Networks
CipherGAN - Unsupervised Cipher Cracking Using Discrete GANs
CM-GAN - CM-GANs: Cross-modal Generative Adversarial Networks for Common Representation Learning
CoAtt-GAN - Are You Talking to Me? Reasoned Visual Dialog Generation through Adversarial Learning
CoGAN - Coupled Generative Adversarial Networks
ComboGAN - ComboGAN: Unrestrained Scalability for Image Domain Translation (github)
ConceptGAN - Learning Compositional Visual Concepts with Mutual Consistency
Conditional cycleGAN - Conditional CycleGAN for Attribute Guided Face Image Generation
constrast-GAN - Generative Semantic Manipulation with Contrasting GAN
Context-RNN-GAN - Contextual RNN-GANs for Abstract Reasoning Diagram Generation
CorrGAN - Correlated discrete data generation using adversarial training
Coulomb GAN - Coulomb GANs: Provably Optimal Nash Equilibria via Potential Fields
Cover-GAN - Generative Steganography with Kerckhoffs' Principle based on Generative Adversarial Networks
Cramèr GAN - The Cramer Distance as a Solution to Biased Wasserstein Gradients
Cross-GAN - Crossing Generative Adversarial Networks for Cross-View Person Re-identification
crVAE-GAN - Channel-Recurrent Variational Autoencoders
CS-GAN - Improving Neural Machine Translation with Conditional Sequence Generative Adversarial Nets
CVAE-GAN - CVAE-GAN: Fine-Grained Image Generation through Asymmetric Training
CycleGAN - Unpaired Image-to-Image Translation using Cycle-Consistent Adversarial Networks (github)
D-GAN - Differential Generative Adversarial Networks: Synthesizing Non-linear Facial Variations with Limited Number of Training Data
D-WCGAN - I-vector Transformation Using Conditional Generative Adversarial Networks for Short Utterance Speaker Verification
D2GAN - Dual Discriminator Generative Adversarial Nets
D2IA-GAN - Tagging like Humans: Diverse and Distinct Image Annotation
DA-GAN - DA-GAN: Instance-level Image Translation by Deep Attention Generative Adversarial Networks (with Supplementary Materials)
DAGAN - Data Augmentation Generative Adversarial Networks
DAN - Distributional Adversarial Networks
DBLRGAN - Adversarial Spatio-Temporal Learning for Video Deblurring
DCGAN - Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks (github)
DeblurGAN - DeblurGAN: Blind Motion Deblurring Using Conditional Adversarial Networks (github)
Defense-GAN - Defense-GAN: Protecting Classifiers Against Adversarial Attacks Using Generative Models
DeliGAN - DeLiGAN : Generative Adversarial Networks for Diverse and Limited Data (github)
DF-GAN - Learning Disentangling and Fusing Networks for Face Completion Under Structured Occlusions
DiscoGAN - Learning to Discover Cross-Domain Relations with Generative Adversarial Networks
DistanceGAN - One-Sided Unsupervised Domain Mapping
DM-GAN - Dual Motion GAN for Future-Flow Embedded Video Prediction
DNA-GAN - DNA-GAN: Learning Disentangled Representations from Multi-Attribute Images
Domain and Geometry Agnostic CNNs for Left Atrium Segmentation in 3D Ultrasound - https://arxiv.org/abs/1805.00357 (github)
dp-GAN - Differentially Private Releasing via Deep Generative Model
DP-GAN - DP-GAN: Diversity-Promoting Generative Adversarial Network for Generating Informative and Diversified Text
DPGAN - Differentially Private Generative Adversarial Network
DR-GAN - Representation Learning by Rotating Your Faces
DRAGAN - How to Train Your DRAGAN (github)
DRPAN - Discriminative Region Proposal Adversarial Networks for High-Quality Image-to-Image Translation
DSP-GAN - Depth Structure Preserving Scene Image Generation
DTN - Unsupervised Cross-Domain Image Generation
DualGAN - DualGAN: Unsupervised Dual Learning for Image-to-Image Translation
Dualing GAN - Dualing GANs
Dynamics Transfer GAN - Dynamics Transfer GAN: Generating Video by Transferring Arbitrary Temporal Dynamics from a Source Video to a Single Target Image
E-GAN - Evolutionary Generative Adversarial Networks
EBGAN - Energy-based Generative Adversarial Network
ecGAN - eCommerceGAN : A Generative Adversarial Network for E-commerce
ED//GAN - Stabilizing Training of Generative Adversarial Networks through Regularization
EGAN - Enhanced Experience Replay Generation for Efficient Reinforcement Learning
ELEGANT - ELEGANT: Exchanging Latent Encodings with GAN for Transferring Multiple Face Attributes
EnergyWGAN - Energy-relaxed Wassertein GANs (EnergyWGAN): Towards More Stable and High Resolution Image Generation
ExGAN - Eye In-Painting with Exemplar Generative Adversarial Networks
ExposureGAN - Exposure: A White-Box Photo Post-Processing Framework (github)
ExprGAN - ExprGAN: Facial Expression Editing with Controllable Expression Intensity
f-CLSWGAN - Feature Generating Networks for Zero-Shot Learning
f-GAN - f-GAN: Training Generative Neural Samplers using Variational Divergence Minimization
FBGAN - Feedback GAN (FBGAN) for DNA: a Novel Feedback-Loop Architecture for Optimizing Protein Functions
FF-GAN - Towards Large-Pose Face Frontalization in the Wild
Fictitious GAN - Fictitious GAN: Training GANs with Historical Models
FIGAN - Frame Interpolation with Multi-Scale Deep Loss Functions and Generative Adversarial Networks
Fila-GAN - Synthesizing Filamentary Structured Images with GANs
First Order GAN - First Order Generative Adversarial Networks (github)
Fisher GAN - Fisher GAN
Flow-GAN - Flow-GAN: Bridging implicit and prescribed learning in generative models
FSEGAN - Exploring Speech Enhancement with Generative Adversarial Networks for Robust Speech Recognition
FTGAN - Hierarchical Video Generation from Orthogonal Information: Optical Flow and Texture
FusedGAN - Semi-supervised FusedGAN for Conditional Image Generation
FusionGAN - Learning to Fuse Music Genres with Generative Adversarial Dual Learning
G2-GAN - Geometry Guided Adversarial Facial Expression Synthesis
GAAN - Generative Adversarial Autoencoder Networks
GAGAN - GAGAN: Geometry-Aware Generative Adverserial Networks
GAMN - Generative Adversarial Mapping Networks
GAN - Generative Adversarial Networks (github)
GAN-ATV - A Novel Approach to Artistic Textual Visualization via GAN
GAN-CLS - Generative Adversarial Text to Image Synthesis (github)
GAN-RS - Towards Qualitative Advancement of Underwater Machine Vision with Generative Adversarial Networks
GAN-sep - GANs for Biological Image Synthesis (github)
GAN-VFS - Generative Adversarial Network-based Synthesis of Visible Faces from Polarimetric Thermal Faces
GANCS - Deep Generative Adversarial Networks for Compressed Sensing Automates MRI
GANDI - Guiding the search in continuous state-action spaces by learning an action sampling distribution from off-target samples
GANG - GANGs: Generative Adversarial Network Games
GANosaic - GANosaic: Mosaic Creation with Generative Texture Manifolds
GAP - Context-Aware Generative Adversarial Privacy
GAWWN - Learning What and Where to Draw (github)
GC-GAN - Geometry-Contrastive Generative Adversarial Network for Facial Expression Synthesis
GeneGAN - GeneGAN: Learning Object Transfiguration and Attribute Subspace from Unpaired Data (github)
GeoGAN - Generating Instance Segmentation Annotation by Geometry-guided GAN
Geometric GAN - Geometric GAN
GLCA-GAN - Global and Local Consistent Age Generative Adversarial Networks
GMAN - Generative Multi-Adversarial Networks
GMM-GAN - Towards Understanding the Dynamics of Generative Adversarial Networks
GoGAN - Gang of GANs: Generative Adversarial Networks with Maximum Margin Ranking
GONet - GONet: A Semi-Supervised Deep Learning Approach For Traversability Estimation
GP-GAN - GP-GAN: Towards Realistic High-Resolution Image Blending (github)
GP-GAN - GP-GAN: Gender Preserving GAN for Synthesizing Faces from Landmarks
GPU - A generative adversarial framework for positive-unlabeled classification
GRAN - Generating images with recurrent adversarial networks (github)
Graphical-GAN - Graphical Generative Adversarial Networks
GraspGAN - Using Simulation and Domain Adaptation to Improve Efficiency of Deep Robotic Grasping
HAN - Chinese Typeface Transformation with Hierarchical Adversarial Network
HP-GAN - HP-GAN: Probabilistic 3D human motion prediction via GAN
HR-DCGAN - High-Resolution Deep Convolutional Generative Adversarial Networks
IAN - Neural Photo Editing with Introspective Adversarial Networks (github)
IcGAN - Invertible Conditional GANs for image editing (github)
ID-CGAN - Image De-raining Using a Conditional Generative Adversarial Network
IdCycleGAN - Face Translation between Images and Videos using Identity-aware CycleGAN
IFcVAEGAN - Conditional Autoencoders with Adversarial Information Factorization
iGAN - Generative Visual Manipulation on the Natural Image Manifold (github)
Improved GAN - Improved Techniques for Training GANs (github)
In2I - In2I : Unsupervised Multi-Image-to-Image Translation Using Generative Adversarial Networks
InfoGAN - InfoGAN: Interpretable Representation Learning by Information Maximizing Generative Adversarial Nets (github)
IRGAN - IRGAN: A Minimax Game for Unifying Generative and Discriminative Information Retrieval models
Iterative-GAN - Two Birds with One Stone: Iteratively Learn Facial Attributes with GANs (github)
IVE-GAN - IVE-GAN: Invariant Encoding Generative Adversarial Networks
iVGAN - Towards an Understanding of Our World by GANing Videos in the Wild (github)
IWGAN - On Unifying Deep Generative Models
KBGAN - KBGAN: Adversarial Learning for Knowledge Graph Embeddings
KGAN - KGAN: How to Break The Minimax Game in GAN
l-GAN - Representation Learning and Adversarial Generation of 3D Point Clouds
LAC-GAN - Grounded Language Understanding for Manipulation Instructions Using GAN-Based Classification
LAGAN - Learning Particle Physics by Example: Location-Aware Generative Adversarial Networks for Physics Synthesis
LAPGAN - Deep Generative Image Models using a Laplacian Pyramid of Adversarial Networks (github)
LB-GAN - Load Balanced GANs for Multi-view Face Image Synthesis
LD-GAN - Linear Discriminant Generative Adversarial Networks
LDAN - Label Denoising Adversarial Network (LDAN) for Inverse Lighting of Face Images
LeakGAN - Long Text Generation via Adversarial Training with Leaked Information
LeGAN - Likelihood Estimation for Generative Adversarial Networks
LGAN - Global versus Localized Generative Adversarial Nets
LR-GAN - LR-GAN: Layered Recursive Generative Adversarial Networks for Image Generation
LS-GAN - Loss-Sensitive Generative Adversarial Networks on Lipschitz Densities
LSGAN - Least Squares Generative Adversarial Networks
MAD-GAN - Multi-Agent Diverse Generative Adversarial Networks
MAGAN - MAGAN: Margin Adaptation for Generative Adversarial Networks
MAGAN - MAGAN: Aligning Biological Manifolds
MalGAN - Generating Adversarial Malware Examples for Black-Box Attacks Based on GAN
MaliGAN - Maximum-Likelihood Augmented Discrete Generative Adversarial Networks
manifold-WGAN - Manifold-valued Image Generation with Wasserstein Adversarial Networks
MARTA-GAN - Deep Unsupervised Representation Learning for Remote Sensing Images
MaskGAN - MaskGAN: Better Text Generation via Filling in the ______
MC-GAN - Multi-Content GAN for Few-Shot Font Style Transfer (github)
McGAN - McGan: Mean and Covariance Feature Matching GAN
MD-GAN - Learning to Generate Time-Lapse Videos Using Multi-Stage Dynamic Generative Adversarial Networks
MDGAN - Mode Regularized Generative Adversarial Networks
MedGAN - Generating Multi-label Discrete Electronic Health Records using Generative Adversarial Networks
MelanoGAN - MelanoGANs: High Resolution Skin Lesion Synthesis with GANs
memoryGAN - Memorization Precedes Generation: Learning Unsupervised GANs with Memory Networks
MGAN - Precomputed Real-Time Texture Synthesis with Markovian Generative Adversarial Networks (github)
MGGAN - Multi-Generator Generative Adversarial Nets
MGGAN - MGGAN: Solving Mode Collapse using Manifold Guided Training
MIL-GAN - Multimodal Storytelling via Generative Adversarial Imitation Learning
MIX+GAN - Generalization and Equilibrium in Generative Adversarial Nets (GANs)
MLGAN - Metric Learning-based Generative Adversarial Network
MMD-GAN - MMD GAN: Towards Deeper Understanding of Moment Matching Network (github)
MMGAN - MMGAN: Manifold Matching Generative Adversarial Network for Generating Images
MoCoGAN - MoCoGAN: Decomposing Motion and Content for Video Generation (github)
ModularGAN - Modular Generative Adversarial Networks
MPM-GAN - Message Passing Multi-Agent GANs
MS-GAN - Temporal Coherency based Criteria for Predicting Video Frames using Deep Multi-stage Generative Adversarial Networks
MTGAN - MTGAN: Speaker Verification through Multitasking Triplet Generative Adversarial Networks
MuseGAN - MuseGAN: Symbolic-domain Music Generation and Accompaniment with Multi-track Sequential Generative Adversarial Networks
MV-BiGAN - Multi-view Generative Adversarial Networks
NAN - Understanding Humans in Crowded Scenes: Deep Nested Adversarial Learning and A New Benchmark for Multi-Human Parsing
NCE-GAN - Dihedral angle prediction using generative adversarial networks
ND-GAN - Novelty Detection with GAN
NetGAN - NetGAN: Generating Graphs via Random Walks
OCAN - One-Class Adversarial Nets for Fraud Detection
OptionGAN - OptionGAN: Learning Joint Reward-Policy Options using Generative Adversarial Inverse Reinforcement Learning
ORGAN - Objective-Reinforced Generative Adversarial Networks (ORGAN) for Sequence Generation Models
ORGAN - 3D Reconstruction of Incomplete Archaeological Objects Using a Generative Adversary Network
OT-GAN - Improving GANs Using Optimal Transport
PacGAN - PacGAN: The power of two samples in generative adversarial networks
PAN - Perceptual Adversarial Networks for Image-to-Image Transformation
PassGAN - PassGAN: A Deep Learning Approach for Password Guessing
Perceptual GAN - Perceptual Generative Adversarial Networks for Small Object Detection
PGAN - Probabilistic Generative Adversarial Networks
PGD-GAN - Solving Linear Inverse Problems Using GAN Priors: An Algorithm with Provable Guarantees
PGGAN - Patch-Based Image Inpainting with Generative Adversarial Networks
Pip-GAN - Pipeline Generative Adversarial Networks for Facial Images Generation with Multiple Attributes
pix2pix - Image-to-Image Translation with Conditional Adversarial Networks (github)
pix2pixHD - High-Resolution Image Synthesis and Semantic Manipulation with Conditional GANs (github)
PixelGAN - PixelGAN Autoencoders
PN-GAN - Pose-Normalized Image Generation for Person Re-identification
Pose-GAN - The Pose Knows: Video Forecasting by Generating Pose Futures
PPAN - Privacy-Preserving Adversarial Networks
PPGN - Plug & Play Generative Networks: Conditional Iterative Generation of Images in Latent Space
PrGAN - 3D Shape Induction from 2D Views of Multiple Objects
ProGanSR - A Fully Progressive Approach to Single-Image Super-Resolution
Progressive GAN - Progressive Growing of GANs for Improved Quality, Stability, and Variation (github)
PS-GAN - Pedestrian-Synthesis-GAN: Generating Pedestrian Data in Real Scene and Beyond
PSGAN - Learning Texture Manifolds with the Periodic Spatial GAN
PS²-GAN - High-Quality Facial Photo-Sketch Synthesis Using Multi-Adversarial Networks
RadialGAN - RadialGAN: Leveraging multiple datasets to improve target-specific predictive models using Generative Adversarial Networks
RAN - RAN4IQA: Restorative Adversarial Nets for No-Reference Image Quality Assessment (github)
RankGAN - Adversarial Ranking for Language Generation
RCGAN - Real-valued (Medical) Time Series Generation with Recurrent Conditional GANs
RefineGAN - Compressed Sensing MRI Reconstruction with Cyclic Loss in Generative Adversarial Networks
RenderGAN - RenderGAN: Generating Realistic Labeled Data
ResGAN - Generative Adversarial Network based on Resnet for Conditional Image Restoration
RNN-WGAN - Language Generation with Recurrent Generative Adversarial Networks without Pre-training (github)
RPGAN - Stabilizing GAN Training with Multiple Random Projections (github)
RTT-GAN - Recurrent Topic-Transition GAN for Visual Paragraph Generation
RWGAN - Relaxed Wasserstein with Applications to GANs
SAD-GAN - SAD-GAN: Synthetic Autonomous Driving using Generative Adversarial Networks
SAGA - Generative Adversarial Learning for Spectrum Sensing
SalGAN - SalGAN: Visual Saliency Prediction with Generative Adversarial Networks (github)
SAR-GAN - Generating High Quality Visible Images from SAR Images Using CNNs
SBADA-GAN - From source to target and back: symmetric bi-directional adaptive GAN
SCH-GAN - SCH-GAN: Semi-supervised Cross-modal Hashing by Generative Adversarial Network
SD-GAN - Semantically Decomposing the Latent Spaces of Generative Adversarial Networks
Sdf-GAN - Sdf-GAN: Semi-supervised Depth Fusion with Multi-scale Adversarial Networks
SEGAN - SEGAN: Speech Enhancement Generative Adversarial Network
SeGAN - SeGAN: Segmenting and Generating the Invisible
SegAN - SegAN: Adversarial Network with Multi-scale L1 Loss for Medical Image Segmentation
SeqGAN - SeqGAN: Sequence Generative Adversarial Nets with Policy Gradient (github)
SG-GAN - Semantic-aware Grad-GAN for Virtual-to-Real Urban Scene Adaption (github)
SGAN - Texture Synthesis with Spatial Generative Adversarial Networks
SGAN - Stacked Generative Adversarial Networks (github)
SGAN - Steganographic Generative Adversarial Networks
SGAN - SGAN: An Alternative Training of Generative Adversarial Networks
sGAN - Generative Adversarial Training for MRA Image Synthesis Using Multi-Contrast MRI
SimGAN - Learning from Simulated and Unsupervised Images through Adversarial Training
SisGAN - Semantic Image Synthesis via Adversarial Learning
SketchGAN - Adversarial Training For Sketch Retrieval
SketchyGAN - SketchyGAN: Towards Diverse and Realistic Sketch to Image Synthesis
SL-GAN - Semi-Latent GAN: Learning to generate and modify facial images from attributes
SN-GAN - Spectral Normalization for Generative Adversarial Networks (github)
Sobolev GAN - Sobolev GAN
Social GAN - Social GAN: Socially Acceptable Trajectories with Generative Adversarial Networks
Softmax GAN - Softmax GAN
Spike-GAN - Synthesizing realistic neural population activity patterns using Generative Adversarial Networks
Splitting GAN - Class-Splitting Generative Adversarial Networks
SRGAN - Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network
SRPGAN - SRPGAN: Perceptual Generative Adversarial Network for Single Image Super Resolution
SS-GAN - Semi-supervised Conditional GANs
ss-InfoGAN - Guiding InfoGAN with Semi-Supervision
SSGAN - SSGAN: Secure Steganography Based on Generative Adversarial Networks
SSL-GAN - Semi-Supervised Learning with Context-Conditional Generative Adversarial Networks
ST-CGAN - Stacked Conditional Generative Adversarial Networks for Jointly Learning Shadow Detection and Shadow Removal
ST-GAN - Style Transfer Generative Adversarial Networks: Learning to Play Chess Differently
ST-GAN - ST-GAN: Spatial Transformer Generative Adversarial Networks for Image Compositing
StackGAN - StackGAN: Text to Photo-realistic Image Synthesis with Stacked Generative Adversarial Networks (github)
StainGAN: Stain Style Transfer for Digital Histological Images - https://arxiv.org/abs/1804.01601 (github)
StarGAN - StarGAN: Unified Generative Adversarial Networks for Multi-Domain Image-to-Image Translation (github)
SteinGAN - Learning Deep Energy Models: Contrastive Divergence vs. Amortized MLE
Super-FAN - Super-FAN: Integrated facial landmark localization and super-resolution of real-world low resolution faces in arbitrary poses with GANs
SVSGAN - SVSGAN: Singing Voice Separation via Generative Adversarial Network
SWGAN - Solving Approximate Wasserstein GANs to Stationarity
SyncGAN - SyncGAN: Synchronize the Latent Space of Cross-modal Generative Adversarial Networks
S^2GAN - Generative Image Modeling using Style and Structure Adversarial Networks
TAC-GAN - TAC-GAN - Text Conditioned Auxiliary Classifier Generative Adversarial Network (github)
TAN - Outline Colorization through Tandem Adversarial Networks
tempoGAN - tempoGAN: A Temporally Coherent, Volumetric GAN for Super-resolution Fluid Flow
Text2Shape - Text2Shape: Generating Shapes from Natural Language by Learning Joint Embeddings
textGAN - Generating Text via Adversarial Training
TextureGAN - TextureGAN: Controlling Deep Image Synthesis with Texture Patches
TGAN - Temporal Generative Adversarial Nets
TGAN - Tensorizing Generative Adversarial Nets
TGAN - Tensor-Generative Adversarial Network with Two-dimensional Sparse Coding: Application to Real-time Indoor Localization
tiny-GAN - Analysis of Nonautonomous Adversarial Systems
TP-GAN - Beyond Face Rotation: Global and Local Perception GAN for Photorealistic and Identity Preserving Frontal View Synthesis
Triple-GAN - Triple Generative Adversarial Nets
tripletGAN - TripletGAN: Training Generative Model with Triplet Loss
TV-GAN - TV-GAN: Generative Adversarial Network Based Thermal to Visible Face Recognition
UGACH - Unsupervised Generative Adversarial Cross-modal Hashing
UGAN - Enhancing Underwater Imagery using Generative Adversarial Networks
Unim2im - Unsupervised Image-to-Image Translation with Generative Adversarial Networks (github)
UNIT - Unsupervised Image-to-image Translation Networks (github)
Unrolled GAN - Unrolled Generative Adversarial Networks (github)
UV-GAN - UV-GAN: Adversarial Facial UV Map Completion for Pose-invariant Face Recognition
VAE-GAN - Autoencoding beyond pixels using a learned similarity metric
VariGAN - Multi-View Image Generation from a Single-View
VAW-GAN - Voice Conversion from Unaligned Corpora using Variational Autoencoding Wasserstein Generative Adversarial Networks
VEEGAN - VEEGAN: Reducing Mode Collapse in GANs using Implicit Variational Learning (github)
VGAN - Generating Videos with Scene Dynamics (github)
VGAN - Generative Adversarial Networks as Variational Training of Energy Based Models (github)
VGAN - Text Generation Based on Generative Adversarial Nets with Latent Variable
ViGAN - Image Generation and Editing with Variational Info Generative Adversarial Networks
VIGAN - VIGAN: Missing View Imputation with Generative Adversarial Networks
VoiceGAN - Voice Impersonation using Generative Adversarial Networks
VOS-GAN - VOS-GAN: Adversarial Learning of Visual-Temporal Dynamics for Unsupervised Dense Prediction in Videos
VRAL - Variance Regularizing Adversarial Learning
WaterGAN - WaterGAN: Unsupervised Generative Network to Enable Real-time Color Correction of Monocular Underwater Images
WaveGAN - Synthesizing Audio with Generative Adversarial Networks
weGAN - Generative Adversarial Nets for Multiple Text Corpora
WGAN - Wasserstein GAN (github)
WGAN-GP - Improved Training of Wasserstein GANs (github)
WS-GAN - Weakly Supervised Generative Adversarial Networks for 3D Reconstruction
XGAN - XGAN: Unsupervised Image-to-Image Translation for many-to-many Mappings
ZipNet-GAN - ZipNet-GAN: Inferring Fine-grained Mobile Traffic Patterns via a Generative Adversarial Neural Network
α-GAN - Variational Approaches for Auto-Encoding Generative Adversarial Networks (github)
β-GAN - Annealed Generative Adversarial Networks
Δ-GAN - Triangle Generative Adversarial Networks

No such module 'TensorFlow'

When my code is running in Xcode's Playground, it says "No such module 'TensorFlow'". But the result of the operation can be printed.

enums cause fatal error

Writing a simple Swift script with an enum causes a fatal error on the command line on macOS for me:

inference.swift:

enum Action {
    case buttonDown
}
$ swift -O inference.swift
<unknown>:0: error: fatal error encountered during compilation; please file a bug report with your project and the crash log
<unknown>:0: note: Program used external function '_$S9inference6ActionOMn' which could not be resolved!
0  swift                    0x000000010b89d8a8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x000000010b89dfb6 SignalHandler(int) + 694
2  libsystem_platform.dylib 0x00007fff61a4fd9a _sigtramp + 26
3  libsystem_platform.dylib 0x0000000119eac547 _sigtramp + 3091580871
4  libsystem_c.dylib        0x00007fff6190a189 abort + 127
5  swift                    0x000000010809ebc7 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*)::$_0::__invoke(void*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) + 519
6  swift                    0x000000010b83927c llvm::report_fatal_error(llvm::Twine const&, bool) + 252
7  swift                    0x0000000108c053ec llvm::RuntimeDyldImpl::resolveExternalSymbols() + 2956
8  swift                    0x0000000108c03ec9 llvm::RuntimeDyldImpl::resolveRelocations() + 201
9  swift                    0x0000000108bf35d1 llvm::MCJIT::finalizeObject() + 433
10 swift                    0x00000001080e1789 swift::RunImmediately(swift::CompilerInstance&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, swift::IRGenOptions&, swift::SILOptions const&) + 3017
11 swift                    0x000000010809e0fe performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 15230
12 swift                    0x000000010809956e swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3310
13 swift                    0x000000010804fe03 main + 2051
14 libdyld.dylib            0x00007fff6184dee1 start + 1
Stack dump:
0.	Program arguments: /Library/Developer/Toolchains/swift-tensorflow-DEVELOPMENT-2018-06-01-a.xctoolchain/usr/bin/swift -frontend -interpret inference.swift -enable-objc-interop -sdk /Applications/Xcode10-beta-1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -O -color-diagnostics -module-name inference 
Abort trap: 6

No errors when I don't have a case in the enum:

enum Action {
}

error: failed to stop process at REPL breakpoint

Xcode 9.2 and macOS 10.12.6.

$ export PATH=/Library/Developer/Toolchains/swift-latest/usr/bin:"${PATH}"
$ swift
error: failed to stop process at REPL breakpoint

In xcode playground, I got no output.
screen shot 2018-05-06 at 10 35 10

error: cannot call value of non-function type 'PythonObject'

Environment:

Ubuntu 16.04
swift --version
Swift version 4.2-dev (LLVM 04bdb56f3d, Clang b44dbbdf44, Swift aa19e11af7)

Source:

import Python
let np = Python.import("numpy")
print(np)
print(np.arange)
let a = np.arange(15).reshape(3, 5)
let b = np.array([6, 7, 8])

Output:

<module 'numpy' from '/usr/lib/python2.7/dist-packages/numpy/__init__.pyc'>
<built-in function arange>

error: cannot call value of non-function type 'PythonObject'
let a = np.arange(15).reshape(3, 5)
        ~~~~~~~~~^
error: cannot call value of non-function type 'PythonObject'
let b = np.array([6, 7, 8])
        ~~~~~~~~^

XCode 9.4 - Swift 4.2-dev cannot import either REPL or inside XCode IDE

Hi there,

I installed swift for tensorflow from https://github.com/tensorflow/swift/blob/master/Installation.md and install the pkg file swift-tensorflow-DEVELOPMENT-2018-06-01-a-osx.pkg

and add export PATH=/Library/Developer/Toolchains/swift-latest/usr/bin:"${PATH}" to the $PATH

as well as selecting swift-for-tensorflow toolchains in Components/Toolchains

I cannot import in command line or import Tensorflow inside the IDE.

Some infor:
Xcode: Version 9.4 (9F1027a)
Swift: Swift version 4.2-dev (LLVM 04bdb56f3d, Clang b44dbbdf44, Swift 70260a59ef)

Thanks,

Running this branch of Swift with the included headers does not allow TensorFlow to be imported

OS: Ubuntu 16.04
Build: 15 August, 2015

Documentation at the end of Installation.md is incorrect. Including these headers through the swift -I /<path-to-toolchain>/usr/lib/swift/clang/include command actually causes problems when trying to import TensorFlow, resulting in an error of redefinitions.

Reproduction steps:

  1. Add the 15 Aug build to path
  2. Run swift -I /<path-to-toolchain>/usr/lib/swift/clang/include
  3. Enter import TensorFlow

Here is a sample error

error: /<directory/usr/lib/lldb/clang/6.0.0/include/module.modulemap:24:8: error redefinition of module '_Builtin_intrinsics'
module _Builtin_intrinsics [system] [extern_c] {
        ^

./usr/lib/swift/clang/include/module.modulemap:24:8: note previously defined here 
module _Builtin_intrinsics [system] [extern_c] {
        ^
…

AD - simplest example

Version 9.4 (9F1027a)
Toolchain: Swift for TensorFlow Development Snapshot 2018-06-01

I'm toying around with automatic differentiation - thus far

func cube(_ x: Float, _ str: String) -> Float {
print(str)
return x * x * x
}

let dCube_dx = #gradient(of: cube, withRespectTo: .0)
let _ =  cube(5, "hi")  // prints "hi" and returns 125
let _ = dCube_dx(5, "hi") // prints "hi" and returns 75

screen shot 2018-06-11 at 14 45 19

reading the docs - it says this is still under development.
https://github.com/tensorflow/swift/blob/master/docs/AutomaticDifferentiation.md
I'll leave this open for now.

Cannot compile a simple tf program but REPL works?!

Hi, I wanted to try out swift for tensorflow, I could set a clion project with the binary files provided for "Ubuntu 16.04" here https://github.com/tensorflow/swift/blob/master/Installation.md. I can successfully run the swift with a TF example in REPL with "swift -I/home/mehran/tfswift/usr/lib/swift/clang/include", but when compiling with clion I get an error for the following simple example, please note that if I comment out var x = Tensor([[1, 2], [3, 4]]) the program runs fine and shows the "hi" output.

import TensorFlow

func main(){
    var x = Tensor([[1, 2], [3, 4]])
    print("Hi")
}
main() 

I added "-I/home/mehran/tfswift/usr/lib/swift/clang/include" in the File/Settings/Build,Execution, Deployment/cmake/build options, to add this option for building with tensorflow but it did not help.
Here is the output:

/home/mehran/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/181.4668.70/bin/cmake/bin/cmake --build /home/mehran/CLionProjects/untitled3/cmake-build-debug --target untitled3 -- -I/home/mehran/tfswift/usr/lib/swift/clang/include
Compile Swift Module 'HelloWorld' (1 sources)
/home/mehran/CLionProjects/untitled3/Sources/main.swift:5:9: warning: initialization of variable 'x' was never used; consider replacing with assignment to '_' or removing it
    var x = Tensor([[1, 2], [3, 4]])
    ~~~~^
    _
/home/mehran/CLionProjects/untitled3/Sources/main.swift:5:20: error: array input is not a constant array of tensors
    var x = Tensor([[1, 2], [3, 4]])
                   ^~~~~~~~~~~~~~~
error: terminated(1): /home/mehran/tfswift/usr/bin/swift-build-tool -f /home/mehran/CLionProjects/untitled3/.build/debug.yaml main output:
    

CMakeFiles/untitled3.dir/build.make:57: recipe for target 'CMakeFiles/untitled3' failed
gmake[3]: *** [CMakeFiles/untitled3] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/untitled3.dir/all' failed
gmake[2]: *** [CMakeFiles/untitled3.dir/all] Error 2
CMakeFiles/Makefile2:79: recipe for target 'CMakeFiles/untitled3.dir/rule' failed
gmake[1]: *** [CMakeFiles/untitled3.dir/rule] Error 2
Makefile:118: recipe for target 'untitled3' failed
gmake: *** [untitled3] Error 2

and here is my cmake file

cmake_minimum_required(VERSION 3.10)
project(untitled3)

add_custom_target(untitled3 ALL
        COMMAND /home/mehran/tfswift/usr/bin/swift build
        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
        SOURCES Package.swift Sources/main.swift)


Compiling @TensorFlowGraph function results in Segmentation fault: 11

Source file attached. Commenting out line 67 allows compilation to complete.
Test.swift.zip

Compiler output:
/Users/Shared/Development/Projects/TensorFlow/TFTests/TFTests/Test.swift:65:6: warning: initialization of immutable value 'a2' was never used; consider replacing with assignment to '_' or removing it let a2 = relu(z2) ~~~~^~ _ 0 swift 0x000000010e9ef258 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40 1 swift 0x000000010e9ee497 llvm::sys::RunSignalHandlers() + 39 2 swift 0x000000010e9ef8d2 SignalHandler(int) + 258 3 libsystem_platform.dylib 0x00007fff583b0f5a _sigtramp + 26 4 libsystem_platform.dylib 0x00007ffee4b7bc50 _sigtramp + 2356981008 5 swift 0x000000010b939f40 swift::BasicCalleeAnalysis::getCalleeList(swift::SILInstruction*) + 272 6 swift 0x000000010b9398ee swift::BottomUpFunctionOrder::DFS(swift::SILFunction*) + 606 7 swift 0x000000010b939aa9 swift::BottomUpFunctionOrder::DFS(swift::SILFunction*) + 1049 8 swift 0x000000010b939aa9 swift::BottomUpFunctionOrder::DFS(swift::SILFunction*) + 1049 9 swift 0x000000010b93a0fb swift::BottomUpFunctionOrder::FindSCCs(swift::SILModule&) + 59 10 swift 0x000000010bb246d3 swift::BottomUpFunctionOrder::getFunctions() + 67 11 swift 0x000000010bb24221 swift::SILPassManager::runFunctionPasses(unsigned int, unsigned int) + 385 12 swift 0x000000010bb252d4 swift::SILPassManager::execute() + 644 13 swift 0x000000010b23bffb swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) + 187 14 swift 0x000000010bb3021e swift::runSILLoweringPasses(swift::SILModule&) + 78 15 swift 0x000000010b0d4b61 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 15393 16 swift 0x000000010b0cfecf swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2943 17 swift 0x000000010b0840c8 main + 1128 18 libdyld.dylib 0x00007fff580a2015 start + 1 Stack dump: 0. Program arguments: /Library/Developer/Toolchains/swift-tensorflow-DEVELOPMENT-2018-08-15-a.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/Shared/Development/Projects/TensorFlow/TFTests/TFTests/Test.swift -emit-module-path /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/Objects-normal/x86_64/Test~partial.swiftmodule -emit-module-doc-path /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/Objects-normal/x86_64/Test~partial.swiftdoc -serialize-diagnostics-path /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/Objects-normal/x86_64/Test.dia -emit-dependencies-path /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/Objects-normal/x86_64/Test.d -emit-reference-dependencies-path /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/Objects-normal/x86_64/Test.swiftdeps -target x86_64-apple-macosx10.13 -enable-objc-interop -sdk /Developer/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Products/Debug -F /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Products/Debug -enable-testing -g -module-cache-path /Users/davef/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 4.2 -O -D DEBUG -serialize-debugging-options -Xcc -working-directory -Xcc /Users/Shared/Development/Projects/TensorFlow/TFTests -Xcc -I/Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/TFTests-generated-files.hmap -Xcc -I/Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/TFTests-own-target-headers.hmap -Xcc -I/Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/TFTests-all-target-headers.hmap -Xcc -iquote -Xcc /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/TFTests-project-headers.hmap -Xcc -I/Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Products/Debug/include -Xcc -I/Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/DerivedSources/x86_64 -Xcc -I/Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/DerivedSources -Xcc -DDEBUG=1 -parse-as-library -module-name TFTests -o /Users/davef/Library/Developer/Xcode/DerivedData/TFTests-fbxvonuzupngogeormcdulkdrmfk/Build/Intermediates.noindex/TFTests.build/Debug/TFTests.build/Objects-normal/x86_64/Test.o

URL object creation failed

Normal toolchain works. but swift for tf toolchain will crash, I tried both in playground and repl.

Error info:

  1> import Foundation
  2> let url = URL(string : "http://google.com")
Process 53589 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x10baca620)
    frame #0: 0x000000010bb8ba73 libswiftFoundation.dylib`outlined init with copy of Foundation.URLQueryItem + 3
libswiftFoundation.dylib`outlined init with copy of Foundation.URLQueryItem:
->  0x10bb8ba73 <+3>:  movq   %rdi, (%rsi)
    0x10bb8ba76 <+6>:  jmp    0x10bba6c8a               ; symbol stub for: objc_retain
    0x10bb8ba7b <+11>: nopl   (%rax,%rax)

libswiftFoundation.dylib`function signature specialization <Arg[0] = Owned To Guaranteed and Exploded> of Foundation.URLQueryItem.name.setter : Swift.String:
    0x10bb8ba80 <+0>:  pushq  %rbp
Target 0: (repl_swift) stopped.
url: URL? = <extracting data from value failed>

Execution interrupted. Enter code to recover and continue.
Enter LLDB commands to investigate (type :help for assistance.)

Jupyter notebook?

Can we try out Swift for Tensorflow in Jupyter / iPython notebooks? iPython notebook significantly boosted the popularity of Python, and could do similar thing for Swift + Tensorflow. Thanks!

Compile error when build from source, with --xcode flag

My Environment:
Mojava beta 8
Xcode 10 beta 5

I can successfully build swift for tensorflow with utils/build-script --enable-tensorflow --release-debuginfo, but when I build with xcode support, which by following command:

utils/build-script --enable-tensorflow --release-debuginfo --xcode

then i encountered compile error as follows:

Build system information
error: Cycle in dependencies between targets 'complete-test' and 'swiftBasic'; building could produce unreliable results.
Cycle path: complete-test → sourcekitd → SourceKitService → swiftBasic → complete-test
Cycle details:
→ Target 'complete-test' has link command with output '/Users/uc/Documents/projects/github/build/Xcode-RelWithDebInfoAssert/swift-macosx-x86_64/RelWithDebInfo/bin/complete-test'
○ Target 'complete-test' has target dependency on Target 'sourcekitd'
→ Target 'sourcekitd' has target dependency on Target 'SourceKitService'
○ That command depends on command in Target 'SourceKitService': script phase “CMake Rules”
→ Target 'SourceKitService' has target dependency on Target 'swiftBasic'
○ That command depends on command in Target 'swiftBasic': script phase “CMake Rules”
→ Target 'swiftBasic' has target dependency on Target 'lib-Basic-8-UnicodeExtendedGraphemeClusters.cpp'

is there a bug with new build system? if so, how can i configure build-script to use legacy build system?

Thanks.

Add support for Python 3

Currently, Swift is hard-coded to use Python 2.7.
Adding Python 3 support is non-trivial because the Python.swift standard library file calls Python C API functions specific to Python 2 (such as PyString_AsString).

There are multiple possible solutions (e.g. separate Python2/Python3 modules), but the best design isn't clear. Separate modules (e.g. import Python2 and import Python3) is unideal because that implies not having a unified Python interface, with separate PythonObject2 and PythonObject3 structs for instance. On the other hand, the Python version becomes explicit and clear in the code.

An interesting solution is to offer a single Python module and to make Python version configurable via runtime flag, e.g. swift --use-python3.

This is great because Python version would be dynamic: rather than building the compiler explicitly with support for Python 2/3, users can specify the version when invoking swift. This also resembles the way Python scripts are run: for a single main.py file, users can run either python2 main.py or python3 main.py.

However, the implementation is less straightforward and runtime calls to dlopen may be required.

Import TensorFlow fails

Swift for TensorFlow toolchain is already selected in xcode pref. but still the import tensorFlow fails with message "No such module 'TensorFlow' "

Python interoperability does not work: cannot call value of non-function type 'PyValue'

Running this code:

let np = Python.import("numpy")
let a = np.arange(15).reshape(3, 5)

throws

py.swift:5:18: error: cannot call value of non-function type 'PyValue'
var a = np.arange(15).reshape(3, 5)
        ~~~~~~~~~^

While np is <module 'numpy' from '/usr/local/lib/python2.7/dist-packages/numpy/__init__.pyc'>

Bu the way, how to link Swift to Python 3?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.