TensorSwift alternatives and similar libraries
Based on the "Machine Learning" category.
Alternatively, view TensorSwift alternatives based on common mentions on social networks and blogs.
-
Bender
Easily craft fast Neural Networks on iOS! Use TensorFlow models. Metal under the hood. -
Awesome-Mobile-Machine-Learning
A curated list of awesome mobile machine learning resources for iOS, Android, and edge devices. -
AIToolbox
A toolbox of AI modules written in Swift: Graphs/Trees, Support Vector Machines, Neural Networks, PCA, K-Means, Genetic Algorithms -
Swift-Brain
Artificial intelligence/machine learning data structures and Swift algorithms for future iOS development. bayes theorem, neural networks, and more AI. -
SwiftCoreMLTools
A Swift library for creating and exporting CoreML Models in Swift -
DL4S
Accelerated tensor operations and dynamic neural networks based on reverse mode automatic differentiation for every device that can run Swift - from watchOS to Linux -
CoreML-samples
Sample code for Core ML using ResNet50 provided by Apple and a custom model generated by coremltools. -
Serrano
A Swift deep learning library with Accelerate and Metal support. -
Tensorflow-iOS
The official Google-built powerful neural network library port for iOS.
Appwrite - The open-source backend cloud platform
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of TensorSwift or a related project?
README
TensorSwift
TensorSwift is a lightweight library to calculate tensors, which has similar APIs to TensorFlow's. TensorSwift is useful to simulate calculating tensors in Swift using models trained by TensorFlow.
let a = Tensor(shape: [2, 3], elements: [1, 2, 3, 4, 5, 6])
let b = Tensor(shape: [2, 3], elements: [7, 8, 9, 10, 11, 12])
let sum = a + b // Tensor(shape: [2, 3], elements: [8, 10, 12, 14, 16, 18])
let mul = a * b // Tensor(shape: [2, 3], elements: [7, 16, 27, 40, 55, 72])
let c = Tensor(shape: [3, 1], elements: [7, 8, 9])
let matmul = a.matmul(c) // Tensor(shape: [2, 1], elements: [50, 122])
let zeros = Tensor(shape: [2, 3, 4])
let ones = Tensor(shape: [2, 3, 4], element: 1)
Deep MNIST for Experts
[deep-mnist.gif](Resources/DeepMnist.gif)
The following code shows how to simulate Deep MNIST for Experts, a tutorial of TensorFlow, by TensorSwift.
public struct Classifier {
public let W_conv1: Tensor
public let b_conv1: Tensor
public let W_conv2: Tensor
public let b_conv2: Tensor
public let W_fc1: Tensor
public let b_fc1: Tensor
public let W_fc2: Tensor
public let b_fc2: Tensor
public func classify(_ x_image: Tensor) -> Int {
let h_conv1 = (x_image.conv2d(filter: W_conv1, strides: [1, 1, 1]) + b_conv1).relu()
let h_pool1 = h_conv1.maxPool(kernelSize: [2, 2, 1], strides: [2, 2, 1])
let h_conv2 = (h_pool1.conv2d(filter: W_conv2, strides: [1, 1, 1]) + b_conv2).relu()
let h_pool2 = h_conv2.maxPool(kernelSize: [2, 2, 1], strides: [2, 2, 1])
let h_pool2_flat = h_pool2.reshaped([1, Dimension(7 * 7 * 64)])
let h_fc1 = (h_pool2_flat.matmul(W_fc1) + b_fc1).relu()
let y_conv = (h_fc1.matmul(W_fc2) + b_fc2).softmax()
return y_conv.elements.enumerated().max { $0.1 < $1.1 }!.0
}
}
Installation
Swift Package Manager
.Package(url: "[email protected]:qoncept/TensorSwift.git", from: "0.2.0"),
CocoaPods
pod 'TensorSwift', '~> 0.2'
Carthage
github "qoncept/TensorSwift" ~> 0.2
License
[The MIT License](LICENSE)
*Note that all licence references and agreements mentioned in the TensorSwift README section above
are relevant to that project's source code only.