Skip to content

Commit

Permalink
Minor change for README
Browse files Browse the repository at this point in the history
  • Loading branch information
koher committed May 25, 2016
1 parent 19fe8b1 commit 77a671c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# TensorSwift

_TensorSwift_ is a lightweight library to calculate tensors, which has similar APIs to [_TensorFlow_](https://www.tensorflow.org/)'s. _TensorSwift_ is useful to simulate calculating tensors in Swift using models trained by _TensorFlow_.
_TensorSwift_ is a lightweight library to calculate tensors, which has similar APIs to [_TensorFlow_](https://www.tensorflow.org/)'s. _TensorSwift_ is useful to simulate calculating tensors in Swift __using models trained by _TensorFlow___.

```swift
let a = Tensor(shape: [2, 3], elements: [1, 2, 3, 4, 5, 6])
Expand All @@ -19,7 +19,7 @@ let ones = Tensor(shape: [2, 3, 4], element: 1)

![deep-mnist.gif](Resources/DeepMnist.gif)

The following is how to simulate [Deep MNIST for Experts](https://www.tensorflow.org/versions/r0.8/tutorials/mnist/pros/index.html), a tutorial of _TensorFlow_, by _TensorSwift_.
The following code shows how to simulate [Deep MNIST for Experts](https://www.tensorflow.org/versions/r0.8/tutorials/mnist/pros/index.html), a tutorial of _TensorFlow_, by _TensorSwift_.

```swift
public struct Classifier {
Expand All @@ -31,25 +31,25 @@ public struct Classifier {
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.reshape([1, 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.enumerate().maxElement { $0.1 < $1.1 }!.0
}
}
```

## Instration
## Installation

### CocoaPods

Expand Down

0 comments on commit 77a671c

Please sign in to comment.