Last active
April 6, 2018 18:32
-
-
Save JacopoMangiavacchi/39bfbe9cf4d32e9ec38413dcced2a8b6 to your computer and use it in GitHub Desktop.
TensorFlow Swift simulation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import TensorFlow | |
import numsw | |
var tf = TensorFlow() | |
let a = tf.constant(NDArray<Float>(shape: [3], elements: [5, 7, 10])) | |
let b = tf.constant(NDArray<Float>(shape: [3], elements: [2, 3, 21])) | |
let c = tf.constant(NDArray<Float>(shape: [3], elements: [3, 5, 7])) | |
var d = a * b // tf.multiply(a,b) | |
var e = c + b // tf.add(c,b) | |
var f = d - e // tf.subtract(d,e) | |
tf.run(f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment