[
  {
    "path": ".gitignore",
    "content": "# Xcode\n#\nbuild/\n*.pbxuser\n!default.pbxuser\n*.mode1v3\n!default.mode1v3\n*.mode2v3\n!default.mode2v3\n*.perspectivev3\n!default.perspectivev3\nxcuserdata\n*.xccheckout\n*.moved-aside\nDerivedData\n*.hmap\n*.ipa\n*.xcuserstate\n\n# SwiftPackageManager\n#\n.build\n/*.xcodeproj/xcshareddata/\n/*.xcodeproj/project.xcworkspace/xcuserdata/\n/*.xcodeproj/xcuserdata/\n\n# CocoaPods\n#\n# We recommend against adding the Pods directory to your .gitignore. However\n# you should judge for yourself, the pros and cons are mentioned at:\n# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control\n#\n# Pods/\n\n# Carthage\n#\n# Add this line if you want to avoid checking in source code from Carthage dependencies.\n# Carthage/Checkouts\n\nCarthage/Build\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2016 Qoncept, Inc.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "Package.swift",
    "content": "// swift-tools-version:4.0\n// The swift-tools-version declares the minimum version of Swift required to build this package.\n\nimport PackageDescription\n\nlet package = Package(\n    name: \"TensorSwift\",\n    products: [\n        // Products define the executables and libraries produced by a package, and make them visible to other packages.\n        .library(\n            name: \"TensorSwift\",\n            targets: [\"TensorSwift\"]),\n    ],\n    dependencies: [\n        // Dependencies declare other packages that this package depends on.\n        // .package(url: /* package url */, from: \"1.0.0\"),\n    ],\n    targets: [\n        // Targets are the basic building blocks of a package. A target can define a module or a test suite.\n        // Targets can depend on other targets in this package, and on products in packages which this package depends on.\n        .target(\n            name: \"TensorSwift\",\n            dependencies: []),\n        .testTarget(\n            name: \"TensorSwiftTests\",\n            dependencies: [\"TensorSwift\"]),\n    ]\n)\n"
  },
  {
    "path": "README.md",
    "content": "# TensorSwift\n\n_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_**.\n\n```swift\nlet a = Tensor(shape: [2, 3], elements: [1, 2, 3, 4, 5, 6])\nlet b = Tensor(shape: [2, 3], elements: [7, 8, 9, 10, 11, 12])\nlet sum = a + b // Tensor(shape: [2, 3], elements: [8, 10, 12, 14, 16, 18])\nlet mul = a * b // Tensor(shape: [2, 3], elements: [7, 16, 27, 40, 55, 72])\n\nlet c = Tensor(shape: [3, 1], elements: [7, 8, 9])\nlet matmul = a.matmul(c) // Tensor(shape: [2, 1], elements: [50, 122])\n\nlet zeros = Tensor(shape: [2, 3, 4])\nlet ones = Tensor(shape: [2, 3, 4], element: 1)\n```\n\n## Deep MNIST for Experts\n\n![deep-mnist.gif](Resources/DeepMnist.gif)\n\nThe 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_.\n\n```swift\npublic struct Classifier {\n    public let W_conv1: Tensor\n    public let b_conv1: Tensor\n    public let W_conv2: Tensor\n    public let b_conv2: Tensor\n    public let W_fc1: Tensor\n    public let b_fc1: Tensor\n    public let W_fc2: Tensor\n    public let b_fc2: Tensor\n    \n    public func classify(_ x_image: Tensor) -> Int {\n        let h_conv1 = (x_image.conv2d(filter: W_conv1, strides: [1, 1, 1]) + b_conv1).relu()\n        let h_pool1 = h_conv1.maxPool(kernelSize: [2, 2, 1], strides: [2, 2, 1])\n        \n        let h_conv2 = (h_pool1.conv2d(filter: W_conv2, strides: [1, 1, 1]) + b_conv2).relu()\n        let h_pool2 = h_conv2.maxPool(kernelSize: [2, 2, 1], strides: [2, 2, 1])\n        \n        let h_pool2_flat = h_pool2.reshaped([1, Dimension(7 * 7 * 64)])\n        let h_fc1 = (h_pool2_flat.matmul(W_fc1) + b_fc1).relu()\n        \n        let y_conv = (h_fc1.matmul(W_fc2) + b_fc2).softmax()\n\n        return y_conv.elements.enumerated().max { $0.1 < $1.1 }!.0\n    }\n}\n```\n\n## Installation\n\n### Swift Package Manager\n\n```swift\n.Package(url: \"git@github.com:qoncept/TensorSwift.git\", from: \"0.2.0\"),\n```\n\n### CocoaPods\n\n```\npod 'TensorSwift', '~> 0.2'\n```\n\n### Carthage\n\n```\ngithub \"qoncept/TensorSwift\" ~> 0.2\n```\n\n## License\n\n[The MIT License](LICENSE)\n\n"
  },
  {
    "path": "Sources/MNIST/AppDelegate.swift",
    "content": "import UIKit\n\n@UIApplicationMain\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n\n    var window: UIWindow?\n\n\n    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {\n        // Override point for customization after application launch.\n        return true\n    }\n\n    func applicationWillResignActive(_ application: UIApplication) {\n        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.\n        // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.\n    }\n\n    func applicationDidEnterBackground(_ application: UIApplication) {\n        // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.\n        // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.\n    }\n\n    func applicationWillEnterForeground(_ application: UIApplication) {\n        // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.\n    }\n\n    func applicationDidBecomeActive(_ application: UIApplication) {\n        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.\n    }\n\n    func applicationWillTerminate(_ application: UIApplication) {\n        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.\n    }\n\n\n}\n\n"
  },
  {
    "path": "Sources/MNIST/Assets.xcassets/AppIcon.appiconset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"60x60\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"60x60\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"76x76\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"76x76\",\n      \"scale\" : \"2x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "Sources/MNIST/Base.lproj/LaunchScreen.storyboard",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB\" version=\"3.0\" toolsVersion=\"10116\" systemVersion=\"15E65\" targetRuntime=\"iOS.CocoaTouch\" propertyAccessControl=\"none\" useAutolayout=\"YES\" launchScreen=\"YES\" useTraitCollections=\"YES\" initialViewController=\"01J-lp-oVM\">\n    <dependencies>\n        <deployment identifier=\"iOS\"/>\n        <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"10085\"/>\n    </dependencies>\n    <scenes>\n        <!--View Controller-->\n        <scene sceneID=\"EHf-IW-A2E\">\n            <objects>\n                <viewController id=\"01J-lp-oVM\" sceneMemberID=\"viewController\">\n                    <layoutGuides>\n                        <viewControllerLayoutGuide type=\"top\" id=\"Llm-lL-Icb\"/>\n                        <viewControllerLayoutGuide type=\"bottom\" id=\"xb3-aO-Qok\"/>\n                    </layoutGuides>\n                    <view key=\"view\" contentMode=\"scaleToFill\" id=\"Ze5-6b-2t3\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"600\" height=\"600\"/>\n                        <autoresizingMask key=\"autoresizingMask\" widthSizable=\"YES\" heightSizable=\"YES\"/>\n                        <color key=\"backgroundColor\" white=\"1\" alpha=\"1\" colorSpace=\"custom\" customColorSpace=\"calibratedWhite\"/>\n                    </view>\n                </viewController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"iYj-Kq-Ea1\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n            <point key=\"canvasLocation\" x=\"53\" y=\"375\"/>\n        </scene>\n    </scenes>\n</document>\n"
  },
  {
    "path": "Sources/MNIST/Base.lproj/Main.storyboard",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB\" version=\"3.0\" toolsVersion=\"10116\" systemVersion=\"15E65\" targetRuntime=\"iOS.CocoaTouch\" propertyAccessControl=\"none\" useAutolayout=\"YES\" useTraitCollections=\"YES\" initialViewController=\"BYZ-38-t0r\">\n    <dependencies>\n        <deployment identifier=\"iOS\"/>\n        <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"10085\"/>\n        <capability name=\"Aspect ratio constraints\" minToolsVersion=\"5.1\"/>\n    </dependencies>\n    <scenes>\n        <!--View Controller-->\n        <scene sceneID=\"tne-QT-ifu\">\n            <objects>\n                <viewController id=\"BYZ-38-t0r\" customClass=\"ViewController\" customModule=\"MNIST\" customModuleProvider=\"target\" sceneMemberID=\"viewController\">\n                    <layoutGuides>\n                        <viewControllerLayoutGuide type=\"top\" id=\"y3c-jy-aDJ\"/>\n                        <viewControllerLayoutGuide type=\"bottom\" id=\"wfy-db-euE\"/>\n                    </layoutGuides>\n                    <view key=\"view\" contentMode=\"scaleToFill\" id=\"8bC-Xf-vdC\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"600\" height=\"600\"/>\n                        <autoresizingMask key=\"autoresizingMask\" widthSizable=\"YES\" heightSizable=\"YES\"/>\n                        <subviews>\n                            <view contentMode=\"scaleToFill\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"uby-G9-0HG\" customClass=\"CanvasView\" customModule=\"MNIST\" customModuleProvider=\"target\">\n                                <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"600\" height=\"600\"/>\n                                <color key=\"backgroundColor\" white=\"1\" alpha=\"1\" colorSpace=\"calibratedWhite\"/>\n                                <constraints>\n                                    <constraint firstAttribute=\"width\" secondItem=\"uby-G9-0HG\" secondAttribute=\"height\" multiplier=\"1:1\" id=\"iMN-cJ-Vll\"/>\n                                </constraints>\n                            </view>\n                            <button opaque=\"NO\" contentMode=\"scaleToFill\" contentHorizontalAlignment=\"center\" contentVerticalAlignment=\"center\" buttonType=\"roundedRect\" lineBreakMode=\"middleTruncation\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"7vG-JB-rEi\">\n                                <rect key=\"frame\" x=\"273\" y=\"560\" width=\"54\" height=\"30\"/>\n                                <state key=\"normal\" title=\"Classify\"/>\n                                <connections>\n                                    <action selector=\"onPressClassifyButton:\" destination=\"BYZ-38-t0r\" eventType=\"touchUpInside\" id=\"84U-07-SXk\"/>\n                                </connections>\n                            </button>\n                        </subviews>\n                        <color key=\"backgroundColor\" red=\"0.93725490199999995\" green=\"0.93725490199999995\" blue=\"0.95686274510000002\" alpha=\"1\" colorSpace=\"calibratedRGB\"/>\n                        <constraints>\n                            <constraint firstItem=\"wfy-db-euE\" firstAttribute=\"top\" relation=\"greaterThanOrEqual\" secondItem=\"uby-G9-0HG\" secondAttribute=\"bottom\" id=\"3fz-2w-v7P\"/>\n                            <constraint firstItem=\"uby-G9-0HG\" firstAttribute=\"top\" relation=\"greaterThanOrEqual\" secondItem=\"8bC-Xf-vdC\" secondAttribute=\"top\" priority=\"500\" id=\"3ok-ag-yr9\"/>\n                            <constraint firstItem=\"uby-G9-0HG\" firstAttribute=\"centerX\" secondItem=\"8bC-Xf-vdC\" secondAttribute=\"centerX\" id=\"8eu-2d-nsr\"/>\n                            <constraint firstItem=\"7vG-JB-rEi\" firstAttribute=\"centerX\" secondItem=\"8bC-Xf-vdC\" secondAttribute=\"centerX\" id=\"BhB-lX-8dI\"/>\n                            <constraint firstItem=\"wfy-db-euE\" firstAttribute=\"top\" secondItem=\"7vG-JB-rEi\" secondAttribute=\"bottom\" constant=\"10\" id=\"O49-dA-vBd\"/>\n                            <constraint firstAttribute=\"trailing\" relation=\"greaterThanOrEqual\" secondItem=\"uby-G9-0HG\" secondAttribute=\"trailing\" priority=\"500\" id=\"Sfv-CX-pTg\"/>\n                            <constraint firstItem=\"uby-G9-0HG\" firstAttribute=\"width\" secondItem=\"8bC-Xf-vdC\" secondAttribute=\"width\" priority=\"500\" id=\"Wnr-Cj-5Zd\"/>\n                            <constraint firstItem=\"uby-G9-0HG\" firstAttribute=\"height\" secondItem=\"8bC-Xf-vdC\" secondAttribute=\"height\" priority=\"500\" id=\"k6J-97-4Bu\"/>\n                            <constraint firstItem=\"uby-G9-0HG\" firstAttribute=\"leading\" relation=\"greaterThanOrEqual\" secondItem=\"8bC-Xf-vdC\" secondAttribute=\"leading\" priority=\"500\" id=\"mkG-Cu-hyV\"/>\n                            <constraint firstItem=\"uby-G9-0HG\" firstAttribute=\"centerY\" secondItem=\"8bC-Xf-vdC\" secondAttribute=\"centerY\" id=\"pWY-OM-cRn\"/>\n                        </constraints>\n                    </view>\n                    <connections>\n                        <outlet property=\"canvasView\" destination=\"uby-G9-0HG\" id=\"1zv-6w-oc8\"/>\n                    </connections>\n                </viewController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"dkx-z0-nzr\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n        </scene>\n    </scenes>\n</document>\n"
  },
  {
    "path": "Sources/MNIST/Canvas.swift",
    "content": "import CoreGraphics\n\nstruct Canvas {\n    var lines: [Line] = [Line()]\n    \n    mutating func draw(_ point: CGPoint) {\n        lines[lines.endIndex - 1].points.append(point)\n    }\n    \n    mutating func newLine() {\n        lines.append(Line())\n    }\n}\n"
  },
  {
    "path": "Sources/MNIST/CanvasView.swift",
    "content": "import UIKit\n\nclass CanvasView: UIView {\n    private(set) var canvas: Canvas\n    \n    required init?(coder: NSCoder) {\n        canvas = Canvas()\n        super.init(coder: coder)\n        \n        self.addGestureRecognizer(UIPanGestureRecognizer(target: self, action: #selector(CanvasView.onPanGesture(_:))))\n    }\n    \n    var image: UIImage {\n        UIGraphicsBeginImageContext(bounds.size)\n        layer.render(in: UIGraphicsGetCurrentContext()!)\n        let result = UIGraphicsGetImageFromCurrentImageContext()\n        UIGraphicsEndImageContext()\n        return result!\n    }\n\n    override func draw(_ rect: CGRect) {\n        let context = UIGraphicsGetCurrentContext()\n        for line in canvas.lines {\n            context?.setLineWidth(20.0)\n            context?.setStrokeColor(UIColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 1.0).cgColor)\n            context?.setLineCap(.round)\n            context?.setLineJoin(.round)\n            for (index, point) in line.points.enumerated() {\n                if index == 0 {\n                    context?.move(to: CGPoint(x: point.x, y: point.y))\n                } else {\n                    context?.addLine(to: CGPoint(x: point.x, y: point.y))\n                }\n            }\n        }\n        context?.strokePath()\n    }\n    \n    @objc func onPanGesture(_ gestureRecognizer: UIPanGestureRecognizer) {\n        canvas.draw(gestureRecognizer.location(in: self))\n        if gestureRecognizer.state == .ended {\n            canvas.newLine()\n        }\n        \n        setNeedsDisplay()\n    }\n    \n    func clear() {\n        canvas = Canvas()\n        setNeedsDisplay()\n    }\n}\n"
  },
  {
    "path": "Sources/MNIST/Classifier.swift",
    "content": "import Foundation\nimport TensorSwift\n\npublic struct Classifier {\n    public let W_conv1: Tensor\n    public let b_conv1: Tensor\n    public let W_conv2: Tensor\n    public let b_conv2: Tensor\n    public let W_fc1: Tensor\n    public let b_fc1: Tensor\n    public let W_fc2: Tensor\n    public let b_fc2: Tensor\n    \n    public func classify(_ x_image: Tensor) -> Int {\n        let h_conv1 = (x_image.conv2d(filter: W_conv1, strides: [1, 1, 1]) + b_conv1).relu()\n        let h_pool1 = h_conv1.maxPool(kernelSize: [2, 2, 1], strides: [2, 2, 1])\n        \n        let h_conv2 = (h_pool1.conv2d(filter: W_conv2, strides: [1, 1, 1]) + b_conv2).relu()\n        let h_pool2 = h_conv2.maxPool(kernelSize: [2, 2, 1], strides: [2, 2, 1])\n        \n        let h_pool2_flat = h_pool2.reshaped([1, Dimension(7 * 7 * 64)])\n        let h_fc1 = (h_pool2_flat.matmul(W_fc1) + b_fc1).relu()\n        \n        let y_conv = (h_fc1.matmul(W_fc2) + b_fc2).softmax()\n\n        return y_conv.elements.enumerated().max { $0.1 < $1.1 }!.0\n    }\n}\n\nextension Classifier {\n    public init(path: String) {\n        W_conv1 = Tensor(shape: [5, 5, 1, 32], elements: loadFloatArray(path, file: \"W_conv1\"))\n        b_conv1 = Tensor(shape: [32], elements: loadFloatArray(path, file: \"b_conv1\"))\n        W_conv2 = Tensor(shape: [5, 5, 32, 64], elements: loadFloatArray(path, file: \"W_conv2\"))\n        b_conv2 = Tensor(shape: [64], elements: loadFloatArray(path, file: \"b_conv2\"))\n        W_fc1 = Tensor(shape: [Dimension(7 * 7 * 64), 1024], elements: loadFloatArray(path, file: \"W_fc1\"))\n        b_fc1 = Tensor(shape: [1024], elements: loadFloatArray(path, file: \"b_fc1\"))\n        W_fc2 = Tensor(shape: [1024, 10], elements: loadFloatArray(path, file: \"W_fc2\"))\n        b_fc2 = Tensor(shape: [10], elements: loadFloatArray(path, file: \"b_fc2\"))\n    }\n}\n\nprivate func loadFloatArray(_ directory: String, file: String) -> [Float] {\n    let data = try! Data(contentsOf: URL(fileURLWithPath: directory.stringByAppendingPathComponent(file)))\n    return Array(UnsafeBufferPointer(start: UnsafeMutablePointer<Float>(mutating: (data as NSData).bytes.bindMemory(to: Float.self, capacity: data.count)), count: data.count / 4))\n}\n"
  },
  {
    "path": "Sources/MNIST/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UILaunchStoryboardName</key>\n\t<string>LaunchScreen</string>\n\t<key>UIMainStoryboardFile</key>\n\t<string>Main</string>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>armv7</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations~ipad</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationPortraitUpsideDown</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n\t<key>NSAppTransportSecurity</key>\n\t<dict>\n\t\t<key>NSExceptionDomains</key>\n\t\t<dict>\n\t\t\t<key>yann.lecun.com</key>\n\t\t\t<string></string>\n\t\t</dict>\n\t\t<key>NSAllowsArbitraryLoads</key>\n\t\t<true/>\n\t</dict>\n</dict>\n</plist>\n"
  },
  {
    "path": "Sources/MNIST/Line.swift",
    "content": "import CoreGraphics\n\nstruct Line {\n    var points: [CGPoint]\n    \n    init() {\n        self.init([])\n    }\n    \n    init(_ points: [CGPoint]) {\n        self.points = points\n    }\n}"
  },
  {
    "path": "Sources/MNIST/Models/b_conv1",
    "content": "Ԝ=7=֩=x=o=s=Z=^=[;=ߋ=fVj=f=\u0004m=Z=T\u0004=\b==e\u000f=W=\u0018=3=\u0002=\f\u0007=/X=='^=؍=\"=`==[[=d="
  },
  {
    "path": "Sources/MNIST/Models/b_conv2",
    "content": "\u0012=\u0004=^=\r\u0004={F=k=D=_ڴ=f==zI=Ŧ=ܕ=9=\u0001=== =ذ=\\==u='===l=Ҭ=\u001cա=,===O=PͰ==Ķ=\f===\u0007.=\u0019=숵=_=9=~==Li==Ds=k6==9=s===YJ=H=\u001f==%Π=.=\u0004=ׇ==͔="
  },
  {
    "path": "Sources/MNIST/Models/b_fc2",
    "content": "\u0015=K=II==G==6==16=y%="
  },
  {
    "path": "Sources/MNIST/String.swift",
    "content": "import Foundation\n\nextension String {\n    public func stringByAppendingPathComponent(_ str: String) -> String {\n        return (self as NSString).appendingPathComponent(str)\n    }\n}\n"
  },
  {
    "path": "Sources/MNIST/ViewController.swift",
    "content": "import UIKit\nimport TensorSwift\n\nclass ViewController: UIViewController {\n    @IBOutlet private var canvasView: CanvasView!\n    \n    private let inputSize = 28\n    private let classifier = Classifier(path: Bundle.main.resourcePath!)\n\n    @IBAction func onPressClassifyButton(_ sender: UIButton) {\n        let input: Tensor\n        do {\n            let image = canvasView.image\n            \n            let cgImage = image.cgImage!\n            \n            var pixels = [UInt8](repeating: 0, count: inputSize * inputSize)\n            \n            let context  = CGContext(data: &pixels, width: inputSize, height: inputSize, bitsPerComponent: 8, bytesPerRow: inputSize, space: CGColorSpaceCreateDeviceGray(), bitmapInfo: 0)!\n            context.clear(CGRect(x: 0.0, y: 0.0, width: CGFloat(inputSize), height: CGFloat(inputSize)))\n            \n            let rect = CGRect(x: 0.0, y: 0.0, width: CGFloat(inputSize), height: CGFloat(inputSize))\n            context.draw(cgImage, in: rect)\n            \n            input = Tensor(shape: [Dimension(inputSize), Dimension(inputSize), 1], elements: pixels.map { (pixel: UInt8) -> Float in -(Float(pixel) / 255.0 - 0.5) + 0.5 })\n        }\n\n        let estimatedLabel = classifier.classify(input)\n\n        let alertController = UIAlertController(title: \"\\(estimatedLabel)\", message: nil, preferredStyle: .alert)\n        alertController.addAction(UIAlertAction(title: \"Dismiss\", style: .default) { _ in self.canvasView.clear() })\n        present(alertController, animated: true, completion: nil)\n    }\n}\n\n"
  },
  {
    "path": "Sources/TensorSwift/Dimension.swift",
    "content": "public struct Dimension {\n    public let value: Int\n    \n    public init(_ value: Int) {\n        guard value >= 0 else { fatalError(\"`value` must be greater than or equal to 0: \\(value)\") }\n        self.value = value\n    }\n}\n\nextension Dimension: ExpressibleByIntegerLiteral {\n    public init(integerLiteral value: Int) {\n        self.init(value)\n    }\n}\n\nextension Dimension: Equatable {}\npublic func ==(lhs: Dimension, rhs: Dimension) -> Bool {\n    return lhs.value == rhs.value\n}\n\nextension Dimension: CustomStringConvertible {\n    public var description: String {\n        return value.description\n    }\n}\n\npublic func +(lhs: Dimension, rhs: Dimension) -> Dimension {\n    return Dimension(lhs.value + rhs.value)\n}\n\npublic func -(lhs: Dimension, rhs: Dimension) -> Dimension {\n    return Dimension(lhs.value - rhs.value)\n}\n\npublic func *(lhs: Dimension, rhs: Dimension) -> Dimension {\n    return Dimension(lhs.value * rhs.value)\n}\n\npublic func /(lhs: Dimension, rhs: Dimension) -> Dimension {\n    return Dimension(lhs.value / rhs.value)\n}\n"
  },
  {
    "path": "Sources/TensorSwift/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>FMWK</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>$(CURRENT_PROJECT_VERSION)</string>\n\t<key>NSPrincipalClass</key>\n\t<string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Sources/TensorSwift/Operators.swift",
    "content": "infix operator ** : PowerPrecedence\nprecedencegroup PowerPrecedence {\n    associativity: right\n    higherThan: MultiplicationPrecedence\n}\n"
  },
  {
    "path": "Sources/TensorSwift/Shape.swift",
    "content": "public struct Shape {\n    public let dimensions: [Dimension]\n    \n    public func volume() -> Int {\n        return dimensions.reduce(1) { $0 * $1.value }\n    }\n    \n    public init(_ dimensions: [Dimension]) {\n        self.dimensions = dimensions\n    }\n}\n\nextension Shape: ExpressibleByArrayLiteral {\n    public init(arrayLiteral elements: Dimension...) {\n        self.init(elements)\n    }\n}\n\nextension Shape: Equatable {}\npublic func ==(lhs: Shape, rhs: Shape) -> Bool {\n    return lhs.dimensions == rhs.dimensions\n}\n\nextension Shape: CustomStringConvertible {\n    public var description: String {\n        return dimensions.description\n    }\n}\n"
  },
  {
    "path": "Sources/TensorSwift/Tensor.swift",
    "content": "\n#if os(iOS) || os(OSX)\nimport Accelerate\n#endif\n\npublic struct Tensor {\n    public typealias Element = Float\n    \n    public let shape: Shape\n    public fileprivate(set) var elements: [Element]\n    \n    public init(shape: Shape, elements: [Element]) {\n        let volume = shape.volume()\n        precondition(elements.count >= volume, \"`elements.count` must be greater than or equal to `shape.volume`: elements.count = \\(elements.count), shape.volume = \\(shape.volume())\")\n        self.shape = shape\n        self.elements = (elements.count == volume) ? elements : Array(elements[0..<volume])\n    }\n}\n\nextension Tensor { // Additional Initializers\n    public init(shape: Shape, element: Element = 0.0) {\n        self.init(shape: shape, elements: [Element](repeating: element, count: shape.volume()))\n    }\n}\n\nextension Tensor {\n    public mutating func reshape(_ shape: Shape) {\n        self = reshaped(shape)\n    }\n    \n    public func reshaped(_ shape: Shape) -> Tensor {\n        return Tensor(shape: shape, elements: elements)\n    }\n}\n\nextension Tensor { // like CollentionType\n    internal func index(_ indices: [Int]) -> Int {\n        assert(indices.count == shape.dimensions.count, \"`indices.count` must be \\(shape.dimensions.count): \\(indices.count)\")\n        return zip(shape.dimensions, indices).reduce(0) {\n            assert(0 <= $1.1 && $1.1 < $1.0.value, \"Illegal index: indices = \\(indices), shape = \\(shape)\")\n            return $0 * $1.0.value + $1.1\n        }\n    }\n    \n    public subscript(indices: Int...) -> Element {\n        get {\n            return elements[index(indices)]\n        }\n        set {\n            elements[index(indices)] = newValue\n        }\n    }\n    \n    public func volume() -> Int {\n        return shape.volume()\n    }\n}\n\nextension Tensor: Sequence {\n    public func makeIterator() -> IndexingIterator<[Element]> {\n        return elements.makeIterator()\n    }\n}\n\nextension Tensor: Equatable {}\npublic func ==(lhs: Tensor, rhs: Tensor) -> Bool {\n    return lhs.shape == rhs.shape && lhs.elements == rhs.elements\n}\n\ninternal func commutativeBinaryOperation(_ lhs: Tensor, _ rhs: Tensor, operation: (Float, Float) -> Float) -> Tensor {\n    let lSize = lhs.shape.dimensions.count\n    let rSize = rhs.shape.dimensions.count\n    \n    if lSize == rSize {\n        precondition(lhs.shape == rhs.shape, \"Incompatible shapes of tensors: lhs.shape = \\(lhs.shape), rhs.shape = \\(rhs.shape)\")\n        return Tensor(shape: lhs.shape, elements: zipMap(lhs.elements, rhs.elements, operation: operation))\n    }\n    \n    let a: Tensor\n    let b: Tensor\n    if lSize < rSize {\n        a = rhs\n        b = lhs\n    } else {\n        a = lhs\n        b = rhs\n    }\n    assert(hasSuffix(array: a.shape.dimensions, suffix: b.shape.dimensions), \"Incompatible shapes of tensors: lhs.shape = \\(lhs.shape), rhs.shape = \\(rhs.shape)\")\n    \n    return Tensor(shape: a.shape, elements: zipMapRepeat(a.elements, b.elements, operation: operation))\n}\n\ninternal func noncommutativeBinaryOperation(_ lhs: Tensor, _ rhs: Tensor, operation: (Float, Float) -> Float) -> Tensor {\n    let lSize = lhs.shape.dimensions.count\n    let rSize = rhs.shape.dimensions.count\n    \n    if lSize == rSize {\n        precondition(lhs.shape == rhs.shape, \"Incompatible shapes of tensors: lhs.shape = \\(lhs.shape), rhs.shape = \\(rhs.shape)\")\n        return Tensor(shape: lhs.shape, elements: zipMap(lhs.elements, rhs.elements, operation: operation))\n    } else if lSize < rSize {\n        precondition(hasSuffix(array: rhs.shape.dimensions, suffix: lhs.shape.dimensions), \"Incompatible shapes of tensors: lhs.shape = \\(lhs.shape), rhs.shape = \\(rhs.shape)\")\n        return Tensor(shape: rhs.shape, elements: zipMapRepeat(rhs.elements, lhs.elements, operation: { operation($1, $0) }))\n    } else {\n        precondition(hasSuffix(array: lhs.shape.dimensions, suffix: rhs.shape.dimensions), \"Incompatible shapes of tensors: lhs.shape = \\(lhs.shape), rhs.shape = \\(rhs.shape)\")\n        return Tensor(shape: lhs.shape, elements: zipMapRepeat(lhs.elements, rhs.elements, operation: operation))\n    }\n}\n\npublic func +(lhs: Tensor, rhs: Tensor) -> Tensor {\n    return commutativeBinaryOperation(lhs, rhs, operation: +)\n}\n\npublic func -(lhs: Tensor, rhs: Tensor) -> Tensor {\n    return noncommutativeBinaryOperation(lhs, rhs, operation: -)\n}\n\npublic func *(lhs: Tensor, rhs: Tensor) -> Tensor {\n    return commutativeBinaryOperation(lhs, rhs, operation: *)\n}\n\npublic func /(lhs: Tensor, rhs: Tensor) -> Tensor {\n    return noncommutativeBinaryOperation(lhs, rhs, operation: /)\n}\n\npublic func *(lhs: Tensor, rhs: Float) -> Tensor {\n    return Tensor(shape: lhs.shape, elements: lhs.elements.map { $0 * rhs })\n}\n\npublic func *(lhs: Float, rhs: Tensor) -> Tensor {\n    return Tensor(shape: rhs.shape, elements: rhs.elements.map { lhs * $0 })\n}\n\npublic func /(lhs: Tensor, rhs: Float) -> Tensor {\n    return Tensor(shape: lhs.shape, elements: lhs.elements.map { $0 / rhs })\n}\n\npublic func /(lhs: Float, rhs: Tensor) -> Tensor {\n    return Tensor(shape: rhs.shape, elements: rhs.elements.map { lhs / $0 })\n}\n\nextension Tensor { // Matrix\n    public func matmul(_ tensor: Tensor) -> Tensor {\n        precondition(shape.dimensions.count == 2, \"This tensor is not a matrix: shape = \\(shape)\")\n        precondition(tensor.shape.dimensions.count == 2, \"The given tensor is not a matrix: shape = \\(tensor.shape)\")\n        precondition(tensor.shape.dimensions[0] == shape.dimensions[1], \"Incompatible shapes of matrices: self.shape = \\(shape), tensor.shape = \\(tensor.shape)\")\n        \n        #if os(iOS) || os(OSX)\n            let result = Tensor(shape: [shape.dimensions[0], tensor.shape.dimensions[1]])\n            \n            let n = Int32(tensor.shape.dimensions[1].value)\n            let k = Int32(shape.dimensions[1].value)\n            cblas_sgemm(\n                CblasRowMajor,                                // Order\n                CblasNoTrans,                                 // TransA\n                CblasNoTrans,                                 // TransB\n                Int32(shape.dimensions[0].value),             // M\n                n,                                            // N\n                k,                                            // K\n                1.0,                                          // alpha\n                elements,                                     // A\n                k,                                            // lda\n                tensor.elements,                              // B\n                n,                                            // ldb\n                1.0,                                          // beta\n                UnsafeMutablePointer<Float>(mutating: result.elements), // C\n                n                                             // ldc\n            )\n            \n            return result\n        #else\n            let n = shape.dimensions[1].value\n            \n            let numRows = shape.dimensions[0]\n            let numCols = tensor.shape.dimensions[1]\n            \n            let leftHead = UnsafeMutablePointer<Float>(self.elements)\n            let rightHead = UnsafeMutablePointer<Float>(tensor.elements)\n            \n            let elements = [Float](count: (numCols * numRows).value, repeatedValue: 0.0)\n            for r in 0..<numRows.value {\n                for i in 0..<n {\n                    var pointer = UnsafeMutablePointer<Float>(elements) + r * numCols.value\n                    let left = leftHead[r * n + i]\n                    var rightPointer = rightHead + i * numCols.value\n                    for _ in 0..<numCols.value {\n                        pointer.memory += left * rightPointer.memory\n                        pointer += 1\n                        rightPointer += 1\n                    }\n                }\n            }\n            \n            return Tensor(shape: [numRows, numCols], elements: elements)\n        #endif\n    }\n}\n"
  },
  {
    "path": "Sources/TensorSwift/TensorMath.swift",
    "content": "import Darwin\n\npublic func **(lhs: Tensor, rhs: Tensor) -> Tensor {\n    return noncommutativeBinaryOperation(lhs, rhs, operation: powf)\n}\n\npublic func **(lhs: Tensor, rhs: Tensor.Element) -> Tensor {\n    return Tensor(shape: lhs.shape, elements: lhs.elements.map { powf($0, rhs) })\n}\n\npublic func **(lhs: Tensor.Element, rhs: Tensor) -> Tensor {\n    return Tensor(shape: rhs.shape, elements: rhs.elements.map { powf(lhs, $0) })\n}\n\nextension Tensor {\n    public func sin() -> Tensor {\n        return Tensor(shape: shape, elements: elements.map(sinf))\n    }\n\n    public func cos() -> Tensor {\n        return Tensor(shape: shape, elements: elements.map(cosf))\n    }\n\n    public func tan() -> Tensor {\n        return Tensor(shape: shape, elements: elements.map(tanf))\n    }\n\n    public func asin() -> Tensor {\n        return Tensor(shape: shape, elements: elements.map(asinf))\n    }\n    \n    public func acos() -> Tensor {\n        return Tensor(shape: shape, elements: elements.map(acosf))\n    }\n    \n    public func atan() -> Tensor {\n        return Tensor(shape: shape, elements: elements.map(atanf))\n    }\n    \n    public func sinh() -> Tensor {\n        return Tensor(shape: shape, elements: elements.map(sinhf))\n    }\n    \n    public func cosh() -> Tensor {\n        return Tensor(shape: shape, elements: elements.map(coshf))\n    }\n    \n    public func tanh() -> Tensor {\n        return Tensor(shape: shape, elements: elements.map(tanhf))\n    }\n    \n    public func exp() -> Tensor {\n        return Tensor(shape: shape, elements: elements.map(expf))\n    }\n    \n    public func log() -> Tensor {\n        return Tensor(shape: shape, elements: elements.map(logf))\n    }\n    \n    public func sqrt() -> Tensor {\n        return Tensor(shape: shape, elements: elements.map(sqrtf))\n    }\n    \n    public func cbrt() -> Tensor {\n        return Tensor(shape: shape, elements: elements.map(cbrtf))\n    }\n}\n\nextension Tensor {\n    public func sigmoid() -> Tensor {\n        return Tensor(shape: shape, elements: elements.map { 1.0 / (1.0 + expf(-$0)) })\n    }\n}\n"
  },
  {
    "path": "Sources/TensorSwift/TensorNN.swift",
    "content": "import Darwin\n#if os(iOS) || os(OSX)\nimport Accelerate\n#endif\n\nextension Tensor {\n    public func softmax() -> Tensor {\n        let exps = exp()\n        let sum = exps.elements.reduce(0.0, +)\n        return exps / sum\n    }\n    \n    public func relu() -> Tensor {\n        return Tensor(shape: shape, elements: elements.map { fmax($0, 0.0) })\n    }\n}\n\nextension Tensor {\n    public func maxPool(kernelSize: [Int], strides: [Int]) -> Tensor { // padding = Same\n        precondition(shape.dimensions.count == 3, \"`shape.dimensions.count` must be 3: \\(shape.dimensions.count)\")\n        precondition(kernelSize.count == 3, \"`ksize.count` must be 3: \\(kernelSize.count)\")\n        precondition(kernelSize[2] == 1, \"`ksize[3]` != 1 is not supported: \\(kernelSize[2])\")\n        precondition(strides.count == 3, \"`strides.count` must be 3: \\(strides.count)\")\n        precondition(strides[2] == 1, \"`strides[2]` != 1 is not supported: \\(strides[2])\")\n        \n        let inRows = shape.dimensions[0].value\n        let inCols = shape.dimensions[1].value\n        let numChannels = shape.dimensions[2].value\n        \n        let filterHeight = kernelSize[0]\n        let filterWidth = kernelSize[1]\n        \n        let inMinDy = -(filterHeight - 1) / 2\n        let inMaxDy = inMinDy + filterHeight - 1\n        let inMinDx = -(filterWidth - 1) / 2\n        let inMaxDx = inMinDx + filterWidth - 1\n        \n        let rowStride = strides[0]\n        let colStride = strides[1]\n\n        let outRows = shape.dimensions[0].value.ceilDiv(rowStride)\n        let outCols = shape.dimensions[1].value.ceilDiv(colStride)\n        \n        // Initialize with -infinity for maximization.\n        let elements = [Element](repeating: -Float.infinity, count: outCols * outRows * numChannels)\n        \n        for y in 0..<outRows {\n            let inY0 = y * rowStride\n            let inMinY = Swift.max(inY0 + inMinDy, 0)\n            let inMaxY = Swift.min(inY0 + inMaxDy, inRows - 1)\n\n            for inY in inMinY...inMaxY {\n                var outPixelIndex = y * outCols\n                for x in 0..<outCols {\n                    let inX0 = x * colStride\n                    let inMinX = Swift.max(inX0 + inMinDx, 0)\n                    let inMaxX = Swift.min(inX0 + inMaxDx, inCols - 1)\n                    \n                    var inPointer = UnsafeMutablePointer<Element>(mutating: self.elements) + (inY * inCols + inMinX) * numChannels\n                    for _ in inMinX...inMaxX {\n                        var outPointer = UnsafeMutablePointer<Element>(mutating: elements) + outPixelIndex * numChannels\n                        for _ in 0..<numChannels {\n                            outPointer.pointee = Swift.max(outPointer.pointee, inPointer.pointee)\n                            outPointer += 1\n                            inPointer += 1\n                        }\n                    }\n                    outPixelIndex += 1\n                }\n            }\n        }\n        \n        return Tensor(shape: [Dimension(outRows), Dimension(outCols), Dimension(numChannels)], elements: elements)\n    }\n    \n    \n    public func conv2d(filter: Tensor, strides: [Int]) -> Tensor { // padding = Same\n        let inChannels = filter.shape.dimensions[2].value\n        \n        precondition(shape.dimensions.count == 3, \"`shape.dimensions.count` must be 3: \\(shape.dimensions.count)\")\n        precondition(filter.shape.dimensions.count == 4, \"`filter.shape.dimensions.count` must be 4: \\(filter.shape.dimensions.count)\")\n        precondition(strides.count == 3, \"`strides.count` must be 3: \\(strides.count)\")\n        precondition(strides[2] == 1, \"`strides[2]` must be 1\")\n        precondition(shape.dimensions[2].value == inChannels, \"The number of channels of this tensor and the filter are not compatible: \\(shape.dimensions[2]) != \\(inChannels)\")\n        \n        let inRows = shape.dimensions[0].value\n        let inCols = shape.dimensions[1].value\n        \n        let filterHeight = filter.shape.dimensions[0].value\n        let filterWidth = filter.shape.dimensions[1].value\n        \n        let inMinDy = -(filterHeight - 1) / 2\n        let inMaxDy = inMinDy + filterHeight - 1\n        let inMinDx = -(filterWidth - 1) / 2\n        let inMaxDx = inMinDx + filterWidth - 1\n        \n        let rowStride = strides[0]\n        let colStride = strides[1]\n        \n        let outRows = inRows.ceilDiv(rowStride)\n        let outCols = inCols.ceilDiv(colStride)\n        let outChannels = filter.shape.dimensions[3].value\n        \n        #if os(iOS) || os(OSX)\n            let elementsPointer = UnsafePointer<Float>(elements)\n            \n            // a.shape == [outRows * outCols, rowSize]\n            let rowSize = filterHeight * filterWidth * inChannels\n            let a = [Float](repeating: 0, count: outRows * outCols * rowSize)\n            for y in 0..<outRows {\n                let inY0 = y * rowStride\n                let inMinY = Swift.max(inY0 + inMinDy, 0)\n                let inMaxY = Swift.min(inY0 + inMaxDy, inRows - 1)\n                \n                for x in 0..<outCols{\n                    let inX0 = x * colStride\n                    let inMinX = Swift.max(inX0 + inMinDx, 0)\n                    let inMaxX = Swift.min(inX0 + inMaxDx, inCols - 1)\n                    \n                    // Add (x,y)'s patch as a vector\n                    var dest = UnsafeMutablePointer<Float>(mutating: a) + ((y * outCols + x) * filterHeight - Swift.min(inY0 + inMinDy, 0)) * filterWidth * inChannels\n                    var src = elementsPointer + (inMinY * inCols + inMinX) * inChannels\n                    for _ in inMinY...inMaxY {\n                        memcpy(dest - Swift.min(inX0 + inMinDx, 0) * inChannels, src, (inMinX...inMaxX).count * inChannels * MemoryLayout<Float>.size)\n                        dest += filterWidth * inChannels\n                        src += inCols * inChannels\n                    }\n                }\n            }\n            \n            let result = Tensor(shape: [Dimension(outRows), Dimension(outCols), Dimension(outChannels)])\n            \n            let n = Int32(outChannels)\n            let k = Int32(rowSize)\n            \n            // Calculate [M, N] matrix, it automatically turns into [outRows, outCols, outChannels] Tensor\n            cblas_sgemm(\n                CblasRowMajor,                                // Order\n                CblasNoTrans,                                 // TransA\n                CblasNoTrans,                                 // TransB\n                Int32(outRows * outCols),                     // M\n                n,                                            // N\n                k,                                            // K\n                1.0,                                          // alpha\n                UnsafePointer<Float>(a),                      // A\n                k,                                            // lda\n                UnsafePointer<Float>(filter.elements),        // B\n                n,                                            // ldb\n                1.0,                                          // beta\n                UnsafeMutablePointer<Float>(mutating: result.elements), // C\n                n                                             // ldc\n            )\n            \n            return result\n        #else\n            let elements = [Float](count: outCols * outRows * outChannels, repeatedValue: 0.0)\n            \n            for y in 0..<outRows {\n                let inY0 = y * rowStride\n                let inMinY = max(inY0 + inMinDy, 0)\n                let inMaxY = min(inY0 + inMaxDy, inRows - 1)\n                \n                for x in 0..<outCols{\n                    let inX0 = x * colStride\n                    let inMinX = max(inX0 + inMinDx, 0)\n                    let inMaxX = min(inX0 + inMaxDx, inCols - 1)\n                    \n                    let inYOffset = inY0 + inMinDy\n                    let inXOffset = inX0 + inMinDx\n                    \n                    for inY in inMinY...inMaxY {\n                        for inX in inMinX...inMaxX {\n                            matmuladd(\n                                inChannels, outChannels,\n                                (inY * inCols + inX) * inChannels, UnsafeMutablePointer(self.elements),\n                                ((inY - inYOffset) * filterWidth + (inX - inXOffset)) * inChannels * outChannels, UnsafeMutablePointer(filter.elements),\n                                (y * outCols + x) * outChannels, UnsafeMutablePointer(elements)\n                            )\n                        }\n                    }\n                }\n            }\n            \n            return Tensor(shape: [Dimension(outRows), Dimension(outCols), Dimension(outChannels)], elements: elements)\n        #endif\n    }\n}\n\n#if os(iOS) || os(OSX)\n#else\n    private func matmuladd(inCols1Rows2: Int, _ outCols: Int, _ o1: Int, _ vec: UnsafeMutablePointer<Float>, _ o2: Int, _ mat: UnsafeMutablePointer<Float>, _ oo: Int, _ out: UnsafeMutablePointer<Float>) {\n        var v = vec + o1\n        for i in 0..<inCols1Rows2 {\n            var o = out + oo\n            let left = v.memory\n            for c in 0..<outCols {\n                o.memory += left * mat[i * outCols + c + o2]\n                o += 1\n            }\n            v += 1\n        }\n    }\n#endif\n"
  },
  {
    "path": "Sources/TensorSwift/TensorSwift.h",
    "content": "#import <Foundation/Foundation.h>\n\n//! Project version number for TensorSwift.\nFOUNDATION_EXPORT double TensorSwiftVersionNumber;\n\n//! Project version string for TensorSwift.\nFOUNDATION_EXPORT const unsigned char TensorSwiftVersionString[];\n\n// In this header, you should import all the public headers of your framework using statements like #import <TensorSwift/PublicHeader.h>\n\n\n"
  },
  {
    "path": "Sources/TensorSwift/Utils.swift",
    "content": "extension Int {\n    internal func ceilDiv(_ rhs: Int) -> Int {\n        return (self + rhs - 1) / rhs\n    }\n}\n\ninternal func hasSuffix<Element: Equatable>(array: [Element], suffix: [Element]) -> Bool {\n    guard array.count >= suffix.count else { return false }\n    return zip(array[(array.count - suffix.count)..<array.count], suffix).reduce(true) { $0 && $1.0 == $1.1 }\n}\n\ninternal func zipMap(_ a: [Float], _ b: [Float], operation: (Float, Float) -> Float) -> [Float] {\n    var result: [Float] = []\n    for i in a.indices {\n        result.append(operation(a[i], b[i]))\n    }\n    return result\n}\n\ninternal func zipMapRepeat(_ a: [Float], _ infiniteB: [Float], operation: (Float, Float) -> Float) -> [Float] {\n    var result: [Float] = []\n    for i in a.indices {\n        result.append(operation(a[i], infiniteB[i % infiniteB.count]))\n    }\n    return result\n}\n\n"
  },
  {
    "path": "TensorSwift.podspec",
    "content": "Pod::Spec.new do |s|\n  s.name         = \"TensorSwift\"\n  s.version      = \"0.2.2\"\n  s.summary      = \"TensorSwift is a lightweight library to calculate tensors, which has similar APIs to TensorFlow's.\"\n  s.homepage     = \"https://github.com/qoncept/TensorSwift\"\n  s.license      = { :type => \"MIT\", :file => \"LICENSE\" }\n  s.authors      = { \"Yuta Koshizawa\" => \"koshizawa@qoncept.co.jp\", \"Takehiro Araki\" => \"araki@qoncept.co.jp\" }\n\n  s.ios.deployment_target = \"8.0\"\n  s.osx.deployment_target = \"10.9\"\n  # s.watchos.deployment_target = \"2.0\"\n  # s.tvos.deployment_target = \"9.0\"\n  s.source       = { :git => \"https://github.com/qoncept/TensorSwift.git\", :tag => \"#{s.version}\" }\n  s.source_files  = \"Sources/*.swift\"\nend\n"
  },
  {
    "path": "TensorSwift.xcodeproj/Configs/Project.xcconfig",
    "content": "PRODUCT_NAME = $(TARGET_NAME)\nSUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator\nMACOSX_DEPLOYMENT_TARGET = 10.10\nDYLIB_INSTALL_NAME_BASE = @rpath\nOTHER_SWIFT_FLAGS = -DXcode\nCOMBINE_HIDPI_IMAGES = YES\nUSE_HEADERMAP = NO\n"
  },
  {
    "path": "TensorSwift.xcodeproj/TensorSwiftTests_Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>en</string>\n  <key>CFBundleExecutable</key>\n  <string>$(EXECUTABLE_NAME)</string>\n  <key>CFBundleIdentifier</key>\n  <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>$(PRODUCT_NAME)</string>\n  <key>CFBundlePackageType</key>\n  <string>BNDL</string>\n  <key>CFBundleShortVersionString</key>\n  <string>1.0</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>$(CURRENT_PROJECT_VERSION)</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "TensorSwift.xcodeproj/TensorSwift_Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>en</string>\n  <key>CFBundleExecutable</key>\n  <string>$(EXECUTABLE_NAME)</string>\n  <key>CFBundleIdentifier</key>\n  <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>$(PRODUCT_NAME)</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>1.0</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>$(CURRENT_PROJECT_VERSION)</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "TensorSwift.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\tA7C046091D9F514600FAF16F /* TensorSwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7DF6F8E1D9BB9660097CEB7 /* TensorSwiftTests.swift */; };\n\t\tA7C0460A1D9F514600FAF16F /* CalculationPerformanceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7DF6F811D9BB9240097CEB7 /* CalculationPerformanceTests.swift */; };\n\t\tA7C0460B1D9F514600FAF16F /* DimensionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7DF6F821D9BB9240097CEB7 /* DimensionTests.swift */; };\n\t\tA7C0460C1D9F514600FAF16F /* PowerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7DF6F841D9BB9240097CEB7 /* PowerTests.swift */; };\n\t\tA7C0460D1D9F514600FAF16F /* TensorNNTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7DF6F851D9BB9240097CEB7 /* TensorNNTests.swift */; };\n\t\tA7C0460E1D9F514600FAF16F /* TensorSwiftSample.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7DF6F861D9BB9240097CEB7 /* TensorSwiftSample.swift */; };\n\t\tA7C0460F1D9F514600FAF16F /* TensorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7DF6F871D9BB9240097CEB7 /* TensorTests.swift */; };\n\t\tA7C387DE1D9F611D00091506 /* TensorSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = \"_____Product_TensorSwift\" /* TensorSwift.framework */; };\n\t\tA7C387DF1D9F611D00091506 /* TensorSwift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = \"_____Product_TensorSwift\" /* TensorSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\tA7C388031D9F629A00091506 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = A7C388001D9F619000091506 /* libz.tbd */; };\n\t\tD646CEF61DBE1A25003E8A59 /* TensorMathTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = D646CEF51DBE1A25003E8A59 /* TensorMathTest.swift */; };\n\t\tD66840171F9DDD7500D1DE7F /* Dimension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D668400E1F9DDD7500D1DE7F /* Dimension.swift */; };\n\t\tD66840181F9DDD7500D1DE7F /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = D66840101F9DDD7500D1DE7F /* Operators.swift */; };\n\t\tD66840191F9DDD7500D1DE7F /* Shape.swift in Sources */ = {isa = PBXBuildFile; fileRef = D66840111F9DDD7500D1DE7F /* Shape.swift */; };\n\t\tD668401A1F9DDD7500D1DE7F /* Tensor.swift in Sources */ = {isa = PBXBuildFile; fileRef = D66840121F9DDD7500D1DE7F /* Tensor.swift */; };\n\t\tD668401B1F9DDD7500D1DE7F /* TensorMath.swift in Sources */ = {isa = PBXBuildFile; fileRef = D66840131F9DDD7500D1DE7F /* TensorMath.swift */; };\n\t\tD668401C1F9DDD7500D1DE7F /* TensorNN.swift in Sources */ = {isa = PBXBuildFile; fileRef = D66840141F9DDD7500D1DE7F /* TensorNN.swift */; };\n\t\tD668401D1F9DDD7500D1DE7F /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = D66840161F9DDD7500D1DE7F /* Utils.swift */; };\n\t\tD66840271F9DE8DF00D1DE7F /* Array.swift in Sources */ = {isa = PBXBuildFile; fileRef = D668401F1F9DE8DF00D1DE7F /* Array.swift */; };\n\t\tD66840281F9DE8DF00D1DE7F /* ClassifierTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D66840201F9DE8DF00D1DE7F /* ClassifierTests.swift */; };\n\t\tD66840291F9DE8DF00D1DE7F /* Downloader.swift in Sources */ = {isa = PBXBuildFile; fileRef = D66840211F9DE8DF00D1DE7F /* Downloader.swift */; };\n\t\tD668402A1F9DE8DF00D1DE7F /* DownloaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D66840221F9DE8DF00D1DE7F /* DownloaderTests.swift */; };\n\t\tD668402D1F9DE8DF00D1DE7F /* SHA1.swift in Sources */ = {isa = PBXBuildFile; fileRef = D66840261F9DE8DF00D1DE7F /* SHA1.swift */; };\n\t\tD66840451F9DE8F000D1DE7F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D668402F1F9DE8F000D1DE7F /* AppDelegate.swift */; };\n\t\tD66840461F9DE8F000D1DE7F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D66840301F9DE8F000D1DE7F /* Assets.xcassets */; };\n\t\tD66840471F9DE8F000D1DE7F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D66840311F9DE8F000D1DE7F /* LaunchScreen.storyboard */; };\n\t\tD66840481F9DE8F000D1DE7F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D66840331F9DE8F000D1DE7F /* Main.storyboard */; };\n\t\tD66840491F9DE8F000D1DE7F /* Canvas.swift in Sources */ = {isa = PBXBuildFile; fileRef = D66840351F9DE8F000D1DE7F /* Canvas.swift */; };\n\t\tD668404A1F9DE8F000D1DE7F /* CanvasView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D66840361F9DE8F000D1DE7F /* CanvasView.swift */; };\n\t\tD668404B1F9DE8F000D1DE7F /* Classifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = D66840371F9DE8F000D1DE7F /* Classifier.swift */; };\n\t\tD668404D1F9DE8F000D1DE7F /* Line.swift in Sources */ = {isa = PBXBuildFile; fileRef = D66840391F9DE8F000D1DE7F /* Line.swift */; };\n\t\tD668404E1F9DE8F000D1DE7F /* b_conv1 in Resources */ = {isa = PBXBuildFile; fileRef = D668403B1F9DE8F000D1DE7F /* b_conv1 */; };\n\t\tD668404F1F9DE8F000D1DE7F /* b_conv2 in Resources */ = {isa = PBXBuildFile; fileRef = D668403C1F9DE8F000D1DE7F /* b_conv2 */; };\n\t\tD66840501F9DE8F000D1DE7F /* b_fc1 in Resources */ = {isa = PBXBuildFile; fileRef = D668403D1F9DE8F000D1DE7F /* b_fc1 */; };\n\t\tD66840511F9DE8F000D1DE7F /* b_fc2 in Resources */ = {isa = PBXBuildFile; fileRef = D668403E1F9DE8F000D1DE7F /* b_fc2 */; };\n\t\tD66840521F9DE8F000D1DE7F /* W_conv1 in Resources */ = {isa = PBXBuildFile; fileRef = D668403F1F9DE8F000D1DE7F /* W_conv1 */; };\n\t\tD66840531F9DE8F000D1DE7F /* W_conv2 in Resources */ = {isa = PBXBuildFile; fileRef = D66840401F9DE8F000D1DE7F /* W_conv2 */; };\n\t\tD66840541F9DE8F000D1DE7F /* W_fc1 in Resources */ = {isa = PBXBuildFile; fileRef = D66840411F9DE8F000D1DE7F /* W_fc1 */; };\n\t\tD66840551F9DE8F000D1DE7F /* W_fc2 in Resources */ = {isa = PBXBuildFile; fileRef = D66840421F9DE8F000D1DE7F /* W_fc2 */; };\n\t\tD66840561F9DE8F000D1DE7F /* String.swift in Sources */ = {isa = PBXBuildFile; fileRef = D66840431F9DE8F000D1DE7F /* String.swift */; };\n\t\tD66840571F9DE8F000D1DE7F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D66840441F9DE8F000D1DE7F /* ViewController.swift */; };\n\t\t_LinkFileRef_TensorSwift_via_TensorSwiftTests /* TensorSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = \"_____Product_TensorSwift\" /* TensorSwift.framework */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXContainerItemProxy section */\n\t\tA7C387BA1D9F604900091506 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = __RootObject_ /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = A7C387A51D9F604900091506;\n\t\t\tremoteInfo = MNIST;\n\t\t};\n\t\tA7C387E01D9F611D00091506 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = __RootObject_ /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = \"______Target_TensorSwift\";\n\t\t\tremoteInfo = TensorSwift;\n\t\t};\n\t\tA7DF6EB61D9A1AC40097CEB7 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = __RootObject_ /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = \"______Target_TensorSwift\";\n\t\t\tremoteInfo = TensorSwift;\n\t\t};\n/* End PBXContainerItemProxy section */\n\n/* Begin PBXCopyFilesBuildPhase section */\n\t\tA7C387E21D9F611E00091506 /* Embed Frameworks */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"\";\n\t\t\tdstSubfolderSpec = 10;\n\t\t\tfiles = (\n\t\t\t\tA7C387DF1D9F611D00091506 /* TensorSwift.framework in Embed Frameworks */,\n\t\t\t);\n\t\t\tname = \"Embed Frameworks\";\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXCopyFilesBuildPhase section */\n\n/* Begin PBXFileReference section */\n\t\tA7C387A61D9F604900091506 /* MNIST.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MNIST.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tA7C387B91D9F604900091506 /* MNISTTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MNISTTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tA7C388001D9F619000091506 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = \"sourcecode.text-based-dylib-definition\"; name = libz.tbd; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk/usr/lib/libz.tbd; sourceTree = DEVELOPER_DIR; };\n\t\tA7DF6F811D9BB9240097CEB7 /* CalculationPerformanceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CalculationPerformanceTests.swift; sourceTree = \"<group>\"; };\n\t\tA7DF6F821D9BB9240097CEB7 /* DimensionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DimensionTests.swift; sourceTree = \"<group>\"; };\n\t\tA7DF6F841D9BB9240097CEB7 /* PowerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PowerTests.swift; sourceTree = \"<group>\"; };\n\t\tA7DF6F851D9BB9240097CEB7 /* TensorNNTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TensorNNTests.swift; sourceTree = \"<group>\"; };\n\t\tA7DF6F861D9BB9240097CEB7 /* TensorSwiftSample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TensorSwiftSample.swift; sourceTree = \"<group>\"; };\n\t\tA7DF6F871D9BB9240097CEB7 /* TensorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TensorTests.swift; sourceTree = \"<group>\"; };\n\t\tA7DF6F8E1D9BB9660097CEB7 /* TensorSwiftTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TensorSwiftTests.swift; sourceTree = \"<group>\"; };\n\t\tD646CEF51DBE1A25003E8A59 /* TensorMathTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TensorMathTest.swift; sourceTree = \"<group>\"; };\n\t\tD668400E1F9DDD7500D1DE7F /* Dimension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Dimension.swift; sourceTree = \"<group>\"; };\n\t\tD668400F1F9DDD7500D1DE7F /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\tD66840101F9DDD7500D1DE7F /* Operators.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Operators.swift; sourceTree = \"<group>\"; };\n\t\tD66840111F9DDD7500D1DE7F /* Shape.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Shape.swift; sourceTree = \"<group>\"; };\n\t\tD66840121F9DDD7500D1DE7F /* Tensor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Tensor.swift; sourceTree = \"<group>\"; };\n\t\tD66840131F9DDD7500D1DE7F /* TensorMath.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TensorMath.swift; sourceTree = \"<group>\"; };\n\t\tD66840141F9DDD7500D1DE7F /* TensorNN.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TensorNN.swift; sourceTree = \"<group>\"; };\n\t\tD66840151F9DDD7500D1DE7F /* TensorSwift.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TensorSwift.h; sourceTree = \"<group>\"; };\n\t\tD66840161F9DDD7500D1DE7F /* Utils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = \"<group>\"; };\n\t\tD668401F1F9DE8DF00D1DE7F /* Array.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Array.swift; sourceTree = \"<group>\"; };\n\t\tD66840201F9DE8DF00D1DE7F /* ClassifierTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClassifierTests.swift; sourceTree = \"<group>\"; };\n\t\tD66840211F9DE8DF00D1DE7F /* Downloader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Downloader.swift; sourceTree = \"<group>\"; };\n\t\tD66840221F9DE8DF00D1DE7F /* DownloaderTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DownloaderTests.swift; sourceTree = \"<group>\"; };\n\t\tD66840231F9DE8DF00D1DE7F /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\tD66840241F9DE8DF00D1DE7F /* MNISTTests-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"MNISTTests-Bridging-Header.h\"; sourceTree = \"<group>\"; };\n\t\tD66840261F9DE8DF00D1DE7F /* SHA1.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SHA1.swift; sourceTree = \"<group>\"; };\n\t\tD668402F1F9DE8F000D1DE7F /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = \"<group>\"; };\n\t\tD66840301F9DE8F000D1DE7F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = \"<group>\"; };\n\t\tD66840321F9DE8F000D1DE7F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = \"<group>\"; };\n\t\tD66840341F9DE8F000D1DE7F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = \"<group>\"; };\n\t\tD66840351F9DE8F000D1DE7F /* Canvas.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Canvas.swift; sourceTree = \"<group>\"; };\n\t\tD66840361F9DE8F000D1DE7F /* CanvasView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CanvasView.swift; sourceTree = \"<group>\"; };\n\t\tD66840371F9DE8F000D1DE7F /* Classifier.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Classifier.swift; sourceTree = \"<group>\"; };\n\t\tD66840381F9DE8F000D1DE7F /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\tD66840391F9DE8F000D1DE7F /* Line.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Line.swift; sourceTree = \"<group>\"; };\n\t\tD668403B1F9DE8F000D1DE7F /* b_conv1 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = b_conv1; sourceTree = \"<group>\"; };\n\t\tD668403C1F9DE8F000D1DE7F /* b_conv2 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = b_conv2; sourceTree = \"<group>\"; };\n\t\tD668403D1F9DE8F000D1DE7F /* b_fc1 */ = {isa = PBXFileReference; lastKnownFileType = file; path = b_fc1; sourceTree = \"<group>\"; };\n\t\tD668403E1F9DE8F000D1DE7F /* b_fc2 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = b_fc2; sourceTree = \"<group>\"; };\n\t\tD668403F1F9DE8F000D1DE7F /* W_conv1 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = W_conv1; sourceTree = \"<group>\"; };\n\t\tD66840401F9DE8F000D1DE7F /* W_conv2 */ = {isa = PBXFileReference; lastKnownFileType = file; path = W_conv2; sourceTree = \"<group>\"; };\n\t\tD66840411F9DE8F000D1DE7F /* W_fc1 */ = {isa = PBXFileReference; lastKnownFileType = file; path = W_fc1; sourceTree = \"<group>\"; };\n\t\tD66840421F9DE8F000D1DE7F /* W_fc2 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = W_fc2; sourceTree = \"<group>\"; };\n\t\tD66840431F9DE8F000D1DE7F /* String.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = String.swift; sourceTree = \"<group>\"; };\n\t\tD66840441F9DE8F000D1DE7F /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = \"<group>\"; };\n\t\t__PBXFileRef_Package.swift /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = \"<group>\"; };\n\t\t__PBXFileRef_Resources /* Resources */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Resources; sourceTree = \"<group>\"; };\n\t\t__PBXFileRef_TensorSwift.xcodeproj/Configs/Project.xcconfig /* TensorSwift.xcodeproj/Configs/Project.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = TensorSwift.xcodeproj/Configs/Project.xcconfig; sourceTree = \"<group>\"; };\n\t\t\"_____Product_TensorSwift\" /* TensorSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = TensorSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t\"_____Product_TensorSwiftTests\" /* TensorSwiftTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; path = TensorSwiftTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\tA7C387A31D9F604900091506 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tA7C387DE1D9F611D00091506 /* TensorSwift.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tA7C387B61D9F604900091506 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tA7C388031D9F629A00091506 /* libz.tbd in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t\"___LinkPhase_TensorSwift\" /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 0;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t\"___LinkPhase_TensorSwiftTests\" /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 0;\n\t\t\tfiles = (\n\t\t\t\t_LinkFileRef_TensorSwift_via_TensorSwiftTests /* TensorSwift.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\tA7C387FF1D9F619000091506 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tA7C388001D9F619000091506 /* libz.tbd */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tD668400D1F9DDD7500D1DE7F /* TensorSwift */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD668400E1F9DDD7500D1DE7F /* Dimension.swift */,\n\t\t\t\tD668400F1F9DDD7500D1DE7F /* Info.plist */,\n\t\t\t\tD66840101F9DDD7500D1DE7F /* Operators.swift */,\n\t\t\t\tD66840111F9DDD7500D1DE7F /* Shape.swift */,\n\t\t\t\tD66840121F9DDD7500D1DE7F /* Tensor.swift */,\n\t\t\t\tD66840131F9DDD7500D1DE7F /* TensorMath.swift */,\n\t\t\t\tD66840141F9DDD7500D1DE7F /* TensorNN.swift */,\n\t\t\t\tD66840151F9DDD7500D1DE7F /* TensorSwift.h */,\n\t\t\t\tD66840161F9DDD7500D1DE7F /* Utils.swift */,\n\t\t\t);\n\t\t\tname = TensorSwift;\n\t\t\tpath = Sources/TensorSwift;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tD668401E1F9DE8DF00D1DE7F /* MNISTTests */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD668401F1F9DE8DF00D1DE7F /* Array.swift */,\n\t\t\t\tD66840201F9DE8DF00D1DE7F /* ClassifierTests.swift */,\n\t\t\t\tD66840211F9DE8DF00D1DE7F /* Downloader.swift */,\n\t\t\t\tD66840221F9DE8DF00D1DE7F /* DownloaderTests.swift */,\n\t\t\t\tD66840231F9DE8DF00D1DE7F /* Info.plist */,\n\t\t\t\tD66840241F9DE8DF00D1DE7F /* MNISTTests-Bridging-Header.h */,\n\t\t\t\tD66840261F9DE8DF00D1DE7F /* SHA1.swift */,\n\t\t\t);\n\t\t\tname = MNISTTests;\n\t\t\tpath = Tests/MNISTTests;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tD668402E1F9DE8F000D1DE7F /* MNIST */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD668402F1F9DE8F000D1DE7F /* AppDelegate.swift */,\n\t\t\t\tD66840301F9DE8F000D1DE7F /* Assets.xcassets */,\n\t\t\t\tD66840311F9DE8F000D1DE7F /* LaunchScreen.storyboard */,\n\t\t\t\tD66840331F9DE8F000D1DE7F /* Main.storyboard */,\n\t\t\t\tD66840351F9DE8F000D1DE7F /* Canvas.swift */,\n\t\t\t\tD66840361F9DE8F000D1DE7F /* CanvasView.swift */,\n\t\t\t\tD66840371F9DE8F000D1DE7F /* Classifier.swift */,\n\t\t\t\tD66840381F9DE8F000D1DE7F /* Info.plist */,\n\t\t\t\tD66840391F9DE8F000D1DE7F /* Line.swift */,\n\t\t\t\tD668403A1F9DE8F000D1DE7F /* Models */,\n\t\t\t\tD66840431F9DE8F000D1DE7F /* String.swift */,\n\t\t\t\tD66840441F9DE8F000D1DE7F /* ViewController.swift */,\n\t\t\t);\n\t\t\tname = MNIST;\n\t\t\tpath = Sources/MNIST;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tD668403A1F9DE8F000D1DE7F /* Models */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD668403B1F9DE8F000D1DE7F /* b_conv1 */,\n\t\t\t\tD668403C1F9DE8F000D1DE7F /* b_conv2 */,\n\t\t\t\tD668403D1F9DE8F000D1DE7F /* b_fc1 */,\n\t\t\t\tD668403E1F9DE8F000D1DE7F /* b_fc2 */,\n\t\t\t\tD668403F1F9DE8F000D1DE7F /* W_conv1 */,\n\t\t\t\tD66840401F9DE8F000D1DE7F /* W_conv2 */,\n\t\t\t\tD66840411F9DE8F000D1DE7F /* W_fc1 */,\n\t\t\t\tD66840421F9DE8F000D1DE7F /* W_fc2 */,\n\t\t\t);\n\t\t\tpath = Models;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tTestProducts_ /* Tests */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t\"_____Product_TensorSwiftTests\" /* TensorSwiftTests.xctest */,\n\t\t\t);\n\t\t\tname = Tests;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t\"___RootGroup_\" = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t__PBXFileRef_Package.swift /* Package.swift */,\n\t\t\t\t\"_____Configs_\" /* Configs */,\n\t\t\t\t\"_____Sources_\" /* Sources */,\n\t\t\t\t__PBXFileRef_Resources /* Resources */,\n\t\t\t\t\"_______Tests_\" /* Tests */,\n\t\t\t\t\"____Products_\" /* Products */,\n\t\t\t\tA7C387FF1D9F619000091506 /* Frameworks */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t\"____Products_\" /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tTestProducts_ /* Tests */,\n\t\t\t\t\"_____Product_TensorSwift\" /* TensorSwift.framework */,\n\t\t\t\tA7C387A61D9F604900091506 /* MNIST.app */,\n\t\t\t\tA7C387B91D9F604900091506 /* MNISTTests.xctest */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t\"_____Configs_\" /* Configs */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t__PBXFileRef_TensorSwift.xcodeproj/Configs/Project.xcconfig /* TensorSwift.xcodeproj/Configs/Project.xcconfig */,\n\t\t\t);\n\t\t\tname = Configs;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t\"_____Sources_\" /* Sources */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD668400D1F9DDD7500D1DE7F /* TensorSwift */,\n\t\t\t\tD668402E1F9DE8F000D1DE7F /* MNIST */,\n\t\t\t);\n\t\t\tname = Sources;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t\"_______Group_TensorSwiftTests\" /* TensorSwiftTests */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tA7DF6F8E1D9BB9660097CEB7 /* TensorSwiftTests.swift */,\n\t\t\t\tA7DF6F811D9BB9240097CEB7 /* CalculationPerformanceTests.swift */,\n\t\t\t\tA7DF6F821D9BB9240097CEB7 /* DimensionTests.swift */,\n\t\t\t\tA7DF6F841D9BB9240097CEB7 /* PowerTests.swift */,\n\t\t\t\tD646CEF51DBE1A25003E8A59 /* TensorMathTest.swift */,\n\t\t\t\tA7DF6F851D9BB9240097CEB7 /* TensorNNTests.swift */,\n\t\t\t\tA7DF6F861D9BB9240097CEB7 /* TensorSwiftSample.swift */,\n\t\t\t\tA7DF6F871D9BB9240097CEB7 /* TensorTests.swift */,\n\t\t\t);\n\t\t\tname = TensorSwiftTests;\n\t\t\tpath = Tests/TensorSwiftTests;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t\"_______Tests_\" /* Tests */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t\"_______Group_TensorSwiftTests\" /* TensorSwiftTests */,\n\t\t\t\tD668401E1F9DE8DF00D1DE7F /* MNISTTests */,\n\t\t\t);\n\t\t\tname = Tests;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXNativeTarget section */\n\t\tA7C387A51D9F604900091506 /* MNIST */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = A7C387D11D9F604A00091506 /* Build configuration list for PBXNativeTarget \"MNIST\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tA7C387A21D9F604900091506 /* Sources */,\n\t\t\t\tA7C387A31D9F604900091506 /* Frameworks */,\n\t\t\t\tA7C387A41D9F604900091506 /* Resources */,\n\t\t\t\tA7C387E21D9F611E00091506 /* Embed Frameworks */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\tA7C387E11D9F611D00091506 /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = MNIST;\n\t\t\tproductName = MNIST;\n\t\t\tproductReference = A7C387A61D9F604900091506 /* MNIST.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n\t\tA7C387B81D9F604900091506 /* MNISTTests */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = A7C387D21D9F604A00091506 /* Build configuration list for PBXNativeTarget \"MNISTTests\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tA7C387B51D9F604900091506 /* Sources */,\n\t\t\t\tA7C387B61D9F604900091506 /* Frameworks */,\n\t\t\t\tA7C387B71D9F604900091506 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\tA7C387BB1D9F604900091506 /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = MNISTTests;\n\t\t\tproductName = MNISTTests;\n\t\t\tproductReference = A7C387B91D9F604900091506 /* MNISTTests.xctest */;\n\t\t\tproductType = \"com.apple.product-type.bundle.unit-test\";\n\t\t};\n\t\t\"______Target_TensorSwift\" /* TensorSwift */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = \"_______Confs_TensorSwift\" /* Build configuration list for PBXNativeTarget \"TensorSwift\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tCompilePhase_TensorSwift /* Sources */,\n\t\t\t\t\"___LinkPhase_TensorSwift\" /* Frameworks */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = TensorSwift;\n\t\t\tproductName = TensorSwift;\n\t\t\tproductReference = \"_____Product_TensorSwift\" /* TensorSwift.framework */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n\t\t\"______Target_TensorSwiftTests\" /* TensorSwiftTests */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = \"_______Confs_TensorSwiftTests\" /* Build configuration list for PBXNativeTarget \"TensorSwiftTests\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tCompilePhase_TensorSwiftTests /* Sources */,\n\t\t\t\t\"___LinkPhase_TensorSwiftTests\" /* Frameworks */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t__Dependency_TensorSwift /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = TensorSwiftTests;\n\t\t\tproductName = TensorSwiftTests;\n\t\t\tproductReference = \"_____Product_TensorSwiftTests\" /* TensorSwiftTests.xctest */;\n\t\t\tproductType = \"com.apple.product-type.bundle.unit-test\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t__RootObject_ /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 0800;\n\t\t\t\tLastUpgradeCheck = 0900;\n\t\t\t\tTargetAttributes = {\n\t\t\t\t\tA7C387A51D9F604900091506 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 8.0;\n\t\t\t\t\t\tDevelopmentTeam = 3B8C483UAP;\n\t\t\t\t\t\tLastSwiftMigration = 0900;\n\t\t\t\t\t\tProvisioningStyle = Automatic;\n\t\t\t\t\t};\n\t\t\t\t\tA7C387B81D9F604900091506 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 8.0;\n\t\t\t\t\t\tDevelopmentTeam = 3B8C483UAP;\n\t\t\t\t\t\tLastSwiftMigration = 0900;\n\t\t\t\t\t\tProvisioningStyle = Automatic;\n\t\t\t\t\t\tTestTargetID = A7C387A51D9F604900091506;\n\t\t\t\t\t};\n\t\t\t\t\t\"______Target_TensorSwift\" = {\n\t\t\t\t\t\tLastSwiftMigration = 0900;\n\t\t\t\t\t};\n\t\t\t\t\t\"______Target_TensorSwiftTests\" = {\n\t\t\t\t\t\tLastSwiftMigration = 0800;\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t\tbuildConfigurationList = \"___RootConfs_\" /* Build configuration list for PBXProject \"TensorSwift\" */;\n\t\t\tcompatibilityVersion = \"Xcode 3.2\";\n\t\t\tdevelopmentRegion = English;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\ten,\n\t\t\t\tBase,\n\t\t\t);\n\t\t\tmainGroup = \"___RootGroup_\";\n\t\t\tproductRefGroup = \"____Products_\" /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t\"______Target_TensorSwift\" /* TensorSwift */,\n\t\t\t\t\"______Target_TensorSwiftTests\" /* TensorSwiftTests */,\n\t\t\t\tA7C387A51D9F604900091506 /* MNIST */,\n\t\t\t\tA7C387B81D9F604900091506 /* MNISTTests */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\tA7C387A41D9F604900091506 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tD66840541F9DE8F000D1DE7F /* W_fc1 in Resources */,\n\t\t\t\tD66840521F9DE8F000D1DE7F /* W_conv1 in Resources */,\n\t\t\t\tD668404F1F9DE8F000D1DE7F /* b_conv2 in Resources */,\n\t\t\t\tD66840511F9DE8F000D1DE7F /* b_fc2 in Resources */,\n\t\t\t\tD668404E1F9DE8F000D1DE7F /* b_conv1 in Resources */,\n\t\t\t\tD66840551F9DE8F000D1DE7F /* W_fc2 in Resources */,\n\t\t\t\tD66840501F9DE8F000D1DE7F /* b_fc1 in Resources */,\n\t\t\t\tD66840481F9DE8F000D1DE7F /* Main.storyboard in Resources */,\n\t\t\t\tD66840461F9DE8F000D1DE7F /* Assets.xcassets in Resources */,\n\t\t\t\tD66840471F9DE8F000D1DE7F /* LaunchScreen.storyboard in Resources */,\n\t\t\t\tD66840531F9DE8F000D1DE7F /* W_conv2 in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tA7C387B71D9F604900091506 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\tA7C387A21D9F604900091506 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tD66840561F9DE8F000D1DE7F /* String.swift in Sources */,\n\t\t\t\tD668404B1F9DE8F000D1DE7F /* Classifier.swift in Sources */,\n\t\t\t\tD66840451F9DE8F000D1DE7F /* AppDelegate.swift in Sources */,\n\t\t\t\tD66840491F9DE8F000D1DE7F /* Canvas.swift in Sources */,\n\t\t\t\tD66840571F9DE8F000D1DE7F /* ViewController.swift in Sources */,\n\t\t\t\tD668404A1F9DE8F000D1DE7F /* CanvasView.swift in Sources */,\n\t\t\t\tD668404D1F9DE8F000D1DE7F /* Line.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tA7C387B51D9F604900091506 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tD66840281F9DE8DF00D1DE7F /* ClassifierTests.swift in Sources */,\n\t\t\t\tD66840271F9DE8DF00D1DE7F /* Array.swift in Sources */,\n\t\t\t\tD668402D1F9DE8DF00D1DE7F /* SHA1.swift in Sources */,\n\t\t\t\tD668402A1F9DE8DF00D1DE7F /* DownloaderTests.swift in Sources */,\n\t\t\t\tD66840291F9DE8DF00D1DE7F /* Downloader.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tCompilePhase_TensorSwift /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 0;\n\t\t\tfiles = (\n\t\t\t\tD66840171F9DDD7500D1DE7F /* Dimension.swift in Sources */,\n\t\t\t\tD66840191F9DDD7500D1DE7F /* Shape.swift in Sources */,\n\t\t\t\tD668401C1F9DDD7500D1DE7F /* TensorNN.swift in Sources */,\n\t\t\t\tD668401D1F9DDD7500D1DE7F /* Utils.swift in Sources */,\n\t\t\t\tD668401A1F9DDD7500D1DE7F /* Tensor.swift in Sources */,\n\t\t\t\tD66840181F9DDD7500D1DE7F /* Operators.swift in Sources */,\n\t\t\t\tD668401B1F9DDD7500D1DE7F /* TensorMath.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tCompilePhase_TensorSwiftTests /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 0;\n\t\t\tfiles = (\n\t\t\t\tA7C046091D9F514600FAF16F /* TensorSwiftTests.swift in Sources */,\n\t\t\t\tA7C0460A1D9F514600FAF16F /* CalculationPerformanceTests.swift in Sources */,\n\t\t\t\tA7C0460B1D9F514600FAF16F /* DimensionTests.swift in Sources */,\n\t\t\t\tA7C0460C1D9F514600FAF16F /* PowerTests.swift in Sources */,\n\t\t\t\tD646CEF61DBE1A25003E8A59 /* TensorMathTest.swift in Sources */,\n\t\t\t\tA7C0460D1D9F514600FAF16F /* TensorNNTests.swift in Sources */,\n\t\t\t\tA7C0460E1D9F514600FAF16F /* TensorSwiftSample.swift in Sources */,\n\t\t\t\tA7C0460F1D9F514600FAF16F /* TensorTests.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXTargetDependency section */\n\t\tA7C387BB1D9F604900091506 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = A7C387A51D9F604900091506 /* MNIST */;\n\t\t\ttargetProxy = A7C387BA1D9F604900091506 /* PBXContainerItemProxy */;\n\t\t};\n\t\tA7C387E11D9F611D00091506 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = \"______Target_TensorSwift\" /* TensorSwift */;\n\t\t\ttargetProxy = A7C387E01D9F611D00091506 /* PBXContainerItemProxy */;\n\t\t};\n\t\t__Dependency_TensorSwift /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = \"______Target_TensorSwift\" /* TensorSwift */;\n\t\t\ttargetProxy = A7DF6EB61D9A1AC40097CEB7 /* PBXContainerItemProxy */;\n\t\t};\n/* End PBXTargetDependency section */\n\n/* Begin PBXVariantGroup section */\n\t\tD66840311F9DE8F000D1DE7F /* LaunchScreen.storyboard */ = {\n\t\t\tisa = PBXVariantGroup;\n\t\t\tchildren = (\n\t\t\t\tD66840321F9DE8F000D1DE7F /* Base */,\n\t\t\t);\n\t\t\tname = LaunchScreen.storyboard;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tD66840331F9DE8F000D1DE7F /* Main.storyboard */ = {\n\t\t\tisa = PBXVariantGroup;\n\t\t\tchildren = (\n\t\t\t\tD66840341F9DE8F000D1DE7F /* Base */,\n\t\t\t);\n\t\t\tname = Main.storyboard;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXVariantGroup section */\n\n/* Begin XCBuildConfiguration section */\n\t\tA7C387CB1D9F604A00091506 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVES = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tDEVELOPMENT_TEAM = 3B8C483UAP;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tINFOPLIST_FILE = Sources/MNIST/Info.plist;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = jp.co.qoncept.MNIST;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_SWIFT3_OBJC_INFERENCE = Default;\n\t\t\t\tSWIFT_VERSION = 4.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tA7C387CC1D9F604A00091506 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVES = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tDEVELOPMENT_TEAM = 3B8C483UAP;\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tINFOPLIST_FILE = Sources/MNIST/Info.plist;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = jp.co.qoncept.MNIST;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Owholemodule\";\n\t\t\t\tSWIFT_SWIFT3_OBJC_INFERENCE = Default;\n\t\t\t\tSWIFT_VERSION = 4.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tA7C387CD1D9F604A00091506 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tBUNDLE_LOADER = \"$(TEST_HOST)\";\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVES = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tDEVELOPMENT_TEAM = 3B8C483UAP;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tINFOPLIST_FILE = Tests/MNISTTests/Info.plist;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 10.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = jp.co.qoncept.MNISTTests;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OBJC_BRIDGING_HEADER = \"Tests/MNISTTests/MNISTTests-Bridging-Header.h\";\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_SWIFT3_OBJC_INFERENCE = Default;\n\t\t\t\tSWIFT_VERSION = 4.0;\n\t\t\t\tTEST_HOST = \"$(BUILT_PRODUCTS_DIR)/MNIST.app/MNIST\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tA7C387CE1D9F604A00091506 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tBUNDLE_LOADER = \"$(TEST_HOST)\";\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVES = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tDEVELOPMENT_TEAM = 3B8C483UAP;\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tINFOPLIST_FILE = Tests/MNISTTests/Info.plist;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 10.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = jp.co.qoncept.MNISTTests;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSWIFT_OBJC_BRIDGING_HEADER = \"Tests/MNISTTests/MNISTTests-Bridging-Header.h\";\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Owholemodule\";\n\t\t\t\tSWIFT_SWIFT3_OBJC_INFERENCE = Default;\n\t\t\t\tSWIFT_VERSION = 4.0;\n\t\t\t\tTEST_HOST = \"$(BUILT_PRODUCTS_DIR)/MNIST.app/MNIST\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t_ReleaseConf_TensorSwift /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tDEVELOPMENT_TEAM = 3B8C483UAP;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tFRAMEWORK_SEARCH_PATHS = \"$(PLATFORM_DIR)/Developer/Library/Frameworks\";\n\t\t\t\tINFOPLIST_FILE = TensorSwift.xcodeproj/TensorSwift_Info.plist;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(TOOLCHAIN_DIR)/usr/lib/swift/macosx\";\n\t\t\t\tOTHER_LDFLAGS = \"$(inherited)\";\n\t\t\t\tOTHER_SWIFT_FLAGS = \"$(inherited)\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = TensorSwift;\n\t\t\t\tPRODUCT_MODULE_NAME = \"$(TARGET_NAME:c99extidentifier)\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME:c99extidentifier)\";\n\t\t\t\tSWIFT_SWIFT3_OBJC_INFERENCE = Default;\n\t\t\t\tSWIFT_VERSION = 4.0;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t_ReleaseConf_TensorSwiftTests /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tFRAMEWORK_SEARCH_PATHS = \"$(PLATFORM_DIR)/Developer/Library/Frameworks\";\n\t\t\t\tINFOPLIST_FILE = TensorSwift.xcodeproj/TensorSwiftTests_Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"@loader_path/../Frameworks\";\n\t\t\t\tOTHER_LDFLAGS = \"$(inherited)\";\n\t\t\t\tOTHER_SWIFT_FLAGS = \"$(inherited)\";\n\t\t\t\tSWIFT_VERSION = 3.0;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t\"___DebugConf_TensorSwift\" /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tDEVELOPMENT_TEAM = \"\";\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tFRAMEWORK_SEARCH_PATHS = \"$(PLATFORM_DIR)/Developer/Library/Frameworks\";\n\t\t\t\tINFOPLIST_FILE = TensorSwift.xcodeproj/TensorSwift_Info.plist;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(TOOLCHAIN_DIR)/usr/lib/swift/macosx\";\n\t\t\t\tOTHER_LDFLAGS = \"$(inherited)\";\n\t\t\t\tOTHER_SWIFT_FLAGS = \"$(inherited)\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = TensorSwift;\n\t\t\t\tPRODUCT_MODULE_NAME = \"$(TARGET_NAME:c99extidentifier)\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME:c99extidentifier)\";\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_SWIFT3_OBJC_INFERENCE = Default;\n\t\t\t\tSWIFT_VERSION = 4.0;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t\"___DebugConf_TensorSwiftTests\" /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tFRAMEWORK_SEARCH_PATHS = \"$(PLATFORM_DIR)/Developer/Library/Frameworks\";\n\t\t\t\tINFOPLIST_FILE = TensorSwift.xcodeproj/TensorSwiftTests_Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"@loader_path/../Frameworks\";\n\t\t\t\tOTHER_LDFLAGS = \"$(inherited)\";\n\t\t\t\tOTHER_SWIFT_FLAGS = \"$(inherited)\";\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 3.0;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t\"_____Release_\" /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = __PBXFileRef_TensorSwift.xcodeproj/Configs/Project.xcconfig /* TensorSwift.xcodeproj/Configs/Project.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Owholemodule\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t\"_______Debug_\" /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = __PBXFileRef_TensorSwift.xcodeproj/Configs/Project.xcconfig /* TensorSwift.xcodeproj/Configs/Project.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\tA7C387D11D9F604A00091506 /* Build configuration list for PBXNativeTarget \"MNIST\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tA7C387CB1D9F604A00091506 /* Debug */,\n\t\t\t\tA7C387CC1D9F604A00091506 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Debug;\n\t\t};\n\t\tA7C387D21D9F604A00091506 /* Build configuration list for PBXNativeTarget \"MNISTTests\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tA7C387CD1D9F604A00091506 /* Debug */,\n\t\t\t\tA7C387CE1D9F604A00091506 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Debug;\n\t\t};\n\t\t\"___RootConfs_\" /* Build configuration list for PBXProject \"TensorSwift\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t\"_______Debug_\" /* Debug */,\n\t\t\t\t\"_____Release_\" /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Debug;\n\t\t};\n\t\t\"_______Confs_TensorSwift\" /* Build configuration list for PBXNativeTarget \"TensorSwift\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t\"___DebugConf_TensorSwift\" /* Debug */,\n\t\t\t\t_ReleaseConf_TensorSwift /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Debug;\n\t\t};\n\t\t\"_______Confs_TensorSwiftTests\" /* Build configuration list for PBXNativeTarget \"TensorSwiftTests\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t\"___DebugConf_TensorSwiftTests\" /* Debug */,\n\t\t\t\t_ReleaseConf_TensorSwiftTests /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Debug;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = __RootObject_ /* Project object */;\n}\n"
  },
  {
    "path": "TensorSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"self:\">\n   </FileRef>\n</Workspace>\n"
  },
  {
    "path": "Tests/LinuxMain.swift",
    "content": "import XCTest\n@testable import TensorSwiftTests\n\nXCTMain([\n     testCase(TensorSwiftTests.allTests),\n     testCase(DimensionTests.allTests),\n     testCase(PowerTests.allTests),\n     testCase(TensorTests.allTests),\n     testCase(TensorNNTests.allTests),\n     testCase(CalculationPerformanceTests.allTests),\n     testCase(TensorSwiftSample.allTests),\n])\n"
  },
  {
    "path": "Tests/MNISTTests/Array.swift",
    "content": "extension Array {\n    func grouped(_ count: Int) -> [[Element]] {\n        var result: [[Element]] = []\n        var group: [Element] = []\n        for element in self {\n            group.append(element)\n            if group.count == count {\n                result.append(group)\n                group = []\n            }\n        }\n        return result\n    }\n}\n"
  },
  {
    "path": "Tests/MNISTTests/ClassifierTests.swift",
    "content": "import XCTest\nimport TensorSwift\n@testable import MNIST\n\nclass ClassifierTests: XCTestCase {\n    func testClassify() {\n        \n        let classifier = Classifier(path: Bundle(for: ViewController.self).resourcePath!)\n        let (images, labels) = downloadTestData()\n        \n        let count = 1000\n        \n        let xArray: [[Float]] = images.withUnsafeBytes { ptr in\n            [UInt8](UnsafeBufferPointer(start: UnsafePointer<UInt8>(ptr + 16), count: 28 * 28 * count))\n                .map { Float($0) / 255.0 }\n                .grouped(28 * 28)\n        }\n        \n        let yArray: [Int] = labels.withUnsafeBytes { ptr in\n            [UInt8](UnsafeBufferPointer(start: UnsafePointer<UInt8>(ptr + 8), count: count))\n                .map { Int($0) }\n        }\n        \n        let accuracy = Float(zip(xArray, yArray)\n            .reduce(0) { $0 + (classifier.classify(Tensor(shape: [28, 28, 1], elements: $1.0)) == $1.1 ? 1 : 0) })\n            / Float(yArray.count)\n        \n        print(\"accuracy: \\(accuracy)\")\n        \n        XCTAssertGreaterThan(accuracy, 0.97)\n    }\n}\n"
  },
  {
    "path": "Tests/MNISTTests/Downloader.swift",
    "content": "import Foundation\n\nfunc downloadTestData() -> (images: Data, labels: Data) {\n    let baseUrl = \"http://yann.lecun.com/exdb/mnist/\"\n    \n    let testImagesUrl = URL(string: baseUrl)!.appendingPathComponent(\"t10k-images-idx3-ubyte.gz\")\n    let testLabelsUrl = URL(string: baseUrl)!.appendingPathComponent(\"t10k-labels-idx1-ubyte.gz\")\n    \n    print(\"download: \\(testImagesUrl)\")\n    let testImages = try! Data(contentsOf: testImagesUrl)\n    print(\"download: \\(testLabelsUrl)\")\n    let testLabels = try! Data(contentsOf: testLabelsUrl)\n\n    return (images: ungzip(testImages)!, labels: ungzip(testLabels)!)\n}\n\nprivate func ungzip(_ source: Data) -> Data? {\n    guard source.count > 0 else {\n        return nil\n    }\n    \n    var stream: z_stream = z_stream.init(next_in: UnsafeMutablePointer<Bytef>(mutating: (source as NSData).bytes.bindMemory(to: Bytef.self, capacity: source.count)), avail_in: uint(source.count), total_in: 0, next_out: nil, avail_out: 0, total_out: 0, msg: nil, state: nil, zalloc: nil, zfree: nil, opaque: nil, data_type: 0, adler: 0, reserved: 0)\n    guard inflateInit2_(&stream, MAX_WBITS + 32, ZLIB_VERSION, Int32(MemoryLayout<z_stream>.size)) == Z_OK else {\n        return nil\n    }\n    \n    let data = NSMutableData()\n    \n    while stream.avail_out == 0 {\n        let bufferSize = 0x10000\n        let buffer: UnsafeMutablePointer<Bytef> = UnsafeMutablePointer<Bytef>.allocate(capacity: bufferSize)\n        stream.next_out = buffer\n        stream.avail_out = uint(MemoryLayout.size(ofValue: buffer))\n        inflate(&stream, Z_FINISH)\n        let length: size_t = MemoryLayout.size(ofValue: buffer) - Int(stream.avail_out)\n        if length > 0 {\n            data.append(buffer, length: length)\n        }\n        buffer.deallocate(capacity: bufferSize)\n    }\n    \n    inflateEnd(&stream)\n    return (NSData(data: data as Data) as Data)\n}\n"
  },
  {
    "path": "Tests/MNISTTests/DownloaderTests.swift",
    "content": "import XCTest\n\nclass DownloaderTests: XCTestCase {\n    func testDownloadTestData() {\n        let testData = downloadTestData()\n        \n        XCTAssertEqual(testData.images.count, 7840016)\n        XCTAssertEqual(testData.images.sha1, \"65e11ec1fd220343092a5070b58418b5c2644e26\")\n    }\n}\n"
  },
  {
    "path": "Tests/MNISTTests/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>NSAppTransportSecurity</key>\n\t<dict>\n\t\t<key>NSExceptionDomains</key>\n\t\t<dict>\n\t\t\t<key>yann.lecun.com</key>\n\t\t\t<string></string>\n\t\t</dict>\n\t\t<key>NSAllowsArbitraryLoads</key>\n\t\t<true/>\n\t</dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>BNDL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Tests/MNISTTests/MNISTTests-Bridging-Header.h",
    "content": "#ifndef MNISTTests_Bridging_Header_h\n#define MNISTTests_Bridging_Header_h\n\n#import <CommonCrypto/CommonCrypto.h>\n#import \"zlib.h\"\n\n#endif /* MNISTTests_Bridging_Header_h */\n"
  },
  {
    "path": "Tests/MNISTTests/SHA1.swift",
    "content": "import Foundation\n\nextension Data {\n    var sha1: String {\n        let data = self\n        var digest = [UInt8](repeating: 0, count: Int(CC_SHA1_DIGEST_LENGTH))\n        CC_SHA1((data as NSData).bytes, CC_LONG(data.count), &digest)\n        let hexBytes = digest.map { String(format: \"%02hhx\", $0) }\n        return hexBytes.joined(separator: \"\")\n    }\n}\n"
  },
  {
    "path": "Tests/TensorSwiftTests/CalculationPerformanceTests.swift",
    "content": "import XCTest\n@testable import TensorSwift\n\nprivate func getTensor1000x1000() -> Tensor {\n    let elements = [Float](repeating: 0.1 ,count: 1000*1000)\n    return Tensor(shape: [1000, 1000], elements: elements)\n}\n\nprivate func getTensor1x1000() -> Tensor {\n    let elements = [Float](repeating: 0, count: 1000)\n    return Tensor(shape: [1, 1000], elements: elements)\n}\n\nclass CalculationPerformanceTests : XCTestCase {\n    func testElementAccess(){\n        let W = getTensor1000x1000()\n        measure{\n            for _ in 0..<100000{\n                let _ = W[500,500]\n            }\n        }\n    }\n    \n    func testElementAccessRaw(){\n        let W = getTensor1000x1000()\n        measure{\n            for _ in 0..<100000{\n                let _ = W.elements[500*W.shape.dimensions[1].value + 500]\n            }\n        }\n    }\n    \n    func testMultiplication(){\n        let W = getTensor1000x1000()\n        let x = getTensor1x1000()\n        \n        measure{\n            let _ = x.matmul(W)\n        }\n    }\n    \n    func testMultiplicationRaw() {\n        let W = getTensor1000x1000()\n        let x = getTensor1x1000()\n        \n        measure{\n            let xRow = x.shape.dimensions[0].value\n            let WRow = W.shape.dimensions[0].value\n            let WColumn = W.shape.dimensions[1].value\n            var elements = [Float](repeating: 0, count: 1000)\n            for r in 0..<xRow {\n                for i in 0..<WRow {\n                    let tmp = x.elements[r * WRow + i]\n                    for c in 0..<WColumn {\n                        elements[r * WRow + c] = tmp * W.elements[i * WRow + c]\n                    }\n                }\n            }\n            let _ = Tensor(shape: [1,1000], elements: elements)\n        }\n    }\n    \n    static var allTests : [(String, (CalculationPerformanceTests) -> () throws -> Void)] {\n        return [\n            (\"testElementAccess\", testElementAccess),\n            (\"testElementAccessRaw\", testElementAccessRaw),\n            (\"testElementMultiplication\", testMultiplication),\n            (\"testElementMultiplicationRaw\", testMultiplicationRaw),\n        ]\n    }\n}\n"
  },
  {
    "path": "Tests/TensorSwiftTests/DimensionTests.swift",
    "content": "import XCTest\n@testable import TensorSwift\n\nclass DimensionTests: XCTestCase {\n    func testAdd() {\n        do {\n            let a = Dimension(2)\n            let b = Dimension(3)\n            XCTAssertEqual(a + b, 5)\n        }\n    }\n    \n    func testSub() {\n        do {\n            \n            let a = Dimension(3)\n            let b = Dimension(2)\n            XCTAssertEqual(a - b, 1)\n        }\n    }\n\n    func testMul() {\n        do {\n            let a = Dimension(2)\n            let b = Dimension(3)\n            XCTAssertEqual(a * b, 6)\n        }\n    }\n\n    func testDiv() {\n        do {\n            let a = Dimension(6)\n            let b = Dimension(2)\n            XCTAssertEqual(a / b, 3)\n        }\n    }\n    \n    static var allTests : [(String, (DimensionTests) -> () throws -> Void)] {\n        return [\n            (\"testAdd\", testAdd),\n            (\"testSub\", testSub),\n            (\"testMul\", testMul),\n            (\"testDiv\", testDiv),\n        ]\n    }\n}\n"
  },
  {
    "path": "Tests/TensorSwiftTests/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>BNDL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Tests/TensorSwiftTests/PowerTests.swift",
    "content": "import XCTest\n@testable import TensorSwift\n\nclass PowerTests: XCTestCase {\n\n    func testScalar() {\n        let tensor = Tensor(shape: [2, 2], elements: [1, 2, 3, 4])\n        let scalar = Tensor.Element(2)\n        \n        XCTAssertEqual(tensor ** scalar, Tensor(shape: [2, 2], elements: [1, 4, 9, 16]))\n        XCTAssertEqual(scalar ** tensor, Tensor(shape: [2, 2], elements: [2, 4, 8, 16]))\n        \n        XCTAssertEqual(scalar ** tensor ** scalar, Tensor(shape: [2, 2], elements: [2, 16, 512, 65536]))\n    }\n    \n    func testMatrices() {\n        let tensor = Tensor(shape: [2, 2], elements: [1, 2, 3, 4])\n        let tensor2 = Tensor(shape: [2, 2], elements: [2, 2, 2, 2])\n        \n        XCTAssertEqual(tensor ** tensor2, Tensor(shape: [2, 2], elements: [1, 4, 9, 16]))\n        XCTAssertEqual(tensor ** tensor, Tensor(shape: [2, 2], elements: [1, 4, 27, 256]))\n        \n        XCTAssertEqual(tensor ** tensor2 ** tensor, Tensor(shape: [2, 2], elements: [1, 16, powf(3, 8), powf(4, 16)]))\n    }\n\n    static var allTests : [(String, (PowerTests) -> () throws -> Void)] {\n        return [\n            (\"testScalar\", testScalar),\n            (\"testMatrices\", testMatrices),\n        ]\n    }\n}\n"
  },
  {
    "path": "Tests/TensorSwiftTests/TensorMathTest.swift",
    "content": "import XCTest\n@testable import TensorSwift\n\nclass TensorMathTest: XCTestCase {\n    func testPow() {\n        do {\n            let a = Tensor(shape: [2, 3], elements: [1, 2, 3, 4, 5, 6])\n            let b = Tensor(shape: [2, 3], elements: [6, 5, 4, 3, 2, 1])\n            XCTAssertEqual(a ** b, Tensor(shape: [2, 3], elements: [1, 32, 81, 64, 25, 6]))\n            XCTAssertEqual(b ** a, Tensor(shape: [2, 3], elements: [6, 25, 64, 81, 32, 1]))\n        }\n        \n        do {\n            let a = Tensor(shape: [2, 3, 2], elements: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])\n            let b = Tensor(shape: [2], elements: [2, 3])\n            XCTAssertEqual(a ** b, Tensor(shape: [2, 3, 2], elements: [1, 8, 9, 64, 25, 216, 49, 512, 81, 1000, 121, 1728]))\n            XCTAssertEqual(b ** a, Tensor(shape: [2, 3, 2], elements: [2, 9, 8, 81, 32, 729, 128, 6561, 512, 59049, 2048, 531441]))\n        }\n        \n        do {\n            let a = Tensor(shape: [2, 1, 3, 2], elements: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])\n            let b = Tensor(shape: [3, 2], elements: [6, 5, 4, 3, 2, 1])\n            XCTAssertEqual(a ** b, Tensor(shape: [2, 1, 3, 2], elements: [1, 32, 81, 64, 25, 6, 117649, 32768, 6561, 1000, 121, 12]))\n            XCTAssertEqual(b ** a, Tensor(shape: [2, 1, 3, 2], elements: [6, 25, 64, 81, 32, 1, 279936, 390625, 262144, 59049, 2048, 1]))\n        }\n        \n        do {\n            let a = Tensor(shape: [2, 3], elements: [1, 2, 3, 4, 5, 6])\n            let b: Float = 2.0\n            XCTAssertEqual(a ** b, Tensor(shape: [2, 3], elements: [1, 4, 9, 16, 25, 36]))\n            XCTAssertEqual(b ** a, Tensor(shape: [2, 3], elements: [2, 4, 8, 16, 32, 64]))\n        }\n    }\n    \n    func testSigmoid() {\n        do {\n            let a = Tensor(shape: [2, 3], elements: [-10, -1, 0, 1, 10, 100])\n            XCTAssertEqual(a.sigmoid(), Tensor(shape: [2, 3], elements: [4.53978719e-05, 2.68941432e-01, 5.00000000e-01, 7.31058598e-01, 9.99954581e-01, 1.00000000e+00]))\n        }\n    }\n}\n"
  },
  {
    "path": "Tests/TensorSwiftTests/TensorNNTests.swift",
    "content": "import XCTest\n@testable import TensorSwift\n\nclass TensorNNTests: XCTestCase {\n    func testMaxPool() {\n        do {\n            let a = Tensor(shape: [2,3,1], elements: [0,1,2,3,4,5])\n            let r = a.maxPool(kernelSize: [1,3,1], strides: [1,1,1])\n            XCTAssertEqual(r, Tensor(shape: [2,3,1], elements: [1,2,2,4,5,5]))\n        }\n\n        do {\n            let a = Tensor(shape: [2,2,2], elements: [0,1,2,3,4,5,6,7])\n            \n            do {\n                let r = a.maxPool(kernelSize:[1,2,1], strides: [1,1,1])\n                XCTAssertEqual(r, Tensor(shape: [2,2,2], elements: [2, 3, 2, 3, 6, 7, 6, 7]))\n            }\n            \n            do {\n                let r = a.maxPool(kernelSize:[1,2,1], strides: [1,2,1])\n                XCTAssertEqual(r, Tensor(shape: [2,1,2], elements: [2, 3, 6, 7]))\n            }\n        }\n    }\n    \n    func testConv2d() {\n        do {\n            let a = Tensor(shape: [2,4,1], elements: [1,2,3,4,5,6,7,8])\n            \n            do {\n                let filter = Tensor(shape: [2,1,1,2], elements: [1,2,1,2])\n                let result = a.conv2d(filter: filter, strides: [1,1,1])\n                XCTAssertEqual(result, Tensor(shape: [2,4,2], elements: [6,12,8,16,10,20,12,24,5,10,6,12,7,14,8,16]))\n            }\n            \n            do {\n                let filter = Tensor(shape: [1,1,1,5], elements: [1,2,1,2,3])\n                let result = a.conv2d(filter: filter, strides: [1,1,1])\n                XCTAssertEqual(result, Tensor(shape: [2,4,5], elements: [1,2,1,2,3,2,4,2,4,6,3,6,3,6,9,4,8,4,8,12,5,10,5,10,15,6,12,6,12,18,7,14,7,14,21,8,16,8,16,24]))\n            }\n        }\n        \n        do {\n            let a = Tensor(shape: [2,2,4], elements: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])\n            let filter = Tensor(shape: [1,1,4,2], elements: [1,2,1,2,3,2,1,1])\n            let result = a.conv2d(filter: filter, strides: [1,1,1])\n            XCTAssertEqual(result, Tensor(shape: [2,2,2], elements: [16, 16, 40, 44, 64, 72, 88, 100]))\n        }\n        \n        do {\n            let a = Tensor(shape: [4,2,2], elements: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])\n            let filter = Tensor(shape: [2,2,2,1], elements: [1,2,1,2,3,2,1,1])\n            let result = a.conv2d(filter: filter, strides: [2,2,1])\n            XCTAssertEqual(result, Tensor(shape: [2,1,1], elements: [58,162]))\n        }\n        \n        do {\n            let a = Tensor(shape: [4,4,1], elements: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])\n            let filter = Tensor(shape: [3,3,1,1], elements: [1,2,1,2,3,2,1,1,1])\n            let result = a.conv2d(filter: filter, strides: [3,3,1])\n            XCTAssertEqual(result, Tensor(shape: [2,2,1], elements: [18,33,95,113]))\n        }\n        \n        do {\n            let a = Tensor(shape: [1,3,1], elements: [1,2,3])\n            let filter = Tensor(shape: [1,3,1,2], elements: [1,1,2,2,3,3])\n            let result = a.conv2d(filter: filter, strides: [1,1,1])\n            XCTAssertEqual(result, Tensor(shape: [1,3,2], elements: [8, 8, 14, 14, 8, 8]))\n        }\n    }\n    \n    func testMaxPoolPerformance(){\n        let image = Tensor(shape: [28,28,3], element: 0.1)\n        measure{\n            _ = image.maxPool(kernelSize: [2,2,1], strides: [2,2,1])\n        }\n    }\n    \n    func testConv2dPerformance(){\n        let image = Tensor(shape: [28,28,1], element: 0.1)\n        let filter = Tensor(shape: [5,5,1,16], element: 0.1)\n        measure{\n            _ = image.conv2d(filter: filter, strides: [1,1,1])\n        }\n    }\n    \n    static var allTests : [(String, (TensorNNTests) -> () throws -> Void)] {\n        return [\n            (\"testMaxPool\", testMaxPool),\n            (\"testConv2d\", testConv2d),\n            (\"testMaxPoolPerformance\", testMaxPoolPerformance),\n            (\"testConv2dPerformance\", testConv2dPerformance),\n        ]\n    }\n}\n"
  },
  {
    "path": "Tests/TensorSwiftTests/TensorSwiftSample.swift",
    "content": "import XCTest\nimport TensorSwift\n\nclass TensorSwiftSample: XCTestCase {\n    func testSample() {\n        let a = Tensor(shape: [2, 3], elements: [1, 2, 3, 4, 5, 6])\n        let b = Tensor(shape: [2, 3], elements: [7, 8, 9, 10, 11, 12])\n        let sum = a + b // Tensor(shape: [2, 3], elements: [8, 10, 12, 14, 16, 18])\n        let mul = a * b // Tensor(shape: [2, 3], elements: [7, 16, 27, 40, 55, 72])\n        \n        let c = Tensor(shape: [3, 1], elements: [7, 8, 9])\n        let matmul = a.matmul(c) // Tensor(shape: [2, 1], elements: [50, 122])\n        \n        let zeros = Tensor(shape: [2, 3, 4])\n        let ones = Tensor(shape: [2, 3, 4], element: 1)\n        \n        XCTAssertEqual(sum, Tensor(shape: [2, 3], elements: [8, 10, 12, 14, 16, 18]))\n        XCTAssertEqual(mul, Tensor(shape: [2, 3], elements: [7, 16, 27, 40, 55, 72]))\n        XCTAssertEqual(matmul, Tensor(shape: [2, 1], elements: [50, 122]))\n        XCTAssertEqual(zeros, Tensor(shape: [2, 3, 4], elements: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))\n        XCTAssertEqual(ones, Tensor(shape: [2, 3, 4], elements: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]))\n    }\n    \n    static var allTests : [(String, (TensorSwiftSample) -> () throws -> Void)] {\n        return [\n            (\"testSample\", testSample),\n        ]\n    }\n}\n"
  },
  {
    "path": "Tests/TensorSwiftTests/TensorSwiftTests.swift",
    "content": "//\n//  TensorSwiftTests.swift\n//  TensorSwift\n//\n//  Created by Araki Takehiro on 2016/09/28.\n//\n//\n\nimport XCTest\n\nclass TensorSwiftTests: XCTestCase {\n    \n    override func setUp() {\n        super.setUp()\n        // Put setup code here. This method is called before the invocation of each test method in the class.\n    }\n    \n    override func tearDown() {\n        // Put teardown code here. This method is called after the invocation of each test method in the class.\n        super.tearDown()\n    }\n    \n    static var allTests : [(String, (TensorSwiftTests) -> () throws -> Void)] {\n        return [\n            \n        ]\n    }\n}\n"
  },
  {
    "path": "Tests/TensorSwiftTests/TensorTests.swift",
    "content": "import XCTest\n@testable import TensorSwift\n\nclass TensorTests: XCTestCase {\n    func testIndex() {\n        do {\n            let a = Tensor(shape: [])\n            XCTAssertEqual(a.index([]), 0)\n        }\n        \n        do {\n            let a = Tensor(shape: [7])\n            XCTAssertEqual(a.index([3]), 3)\n        }\n        \n        do {\n            let a = Tensor(shape: [5, 7])\n            XCTAssertEqual(a.index([1, 2]), 9)\n        }\n        \n        do {\n            let a = Tensor(shape: [5, 7, 11])\n            XCTAssertEqual(a.index([3, 1, 2]), 244)\n        }\n    }\n    \n    func testAdd() {\n        do {\n            let a = Tensor(shape: [2, 3], elements: [1, 2, 3, 4, 5, 6])\n            let b = Tensor(shape: [2, 3], elements: [7, 8, 9, 10, 11, 12])\n            let r = a + b\n            XCTAssertEqual(r, Tensor(shape: [2, 3], elements: [8, 10, 12, 14, 16, 18]))\n        }\n        \n        do {\n            let a = Tensor(shape: [2, 3, 2], elements: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])\n            let b = Tensor(shape: [2], elements: [100, 200])\n            XCTAssertEqual(a + b, Tensor(shape: [2, 3, 2], elements: [101, 202, 103, 204, 105, 206, 107, 208, 109, 210, 111, 212]))\n            XCTAssertEqual(b + a, Tensor(shape: [2, 3, 2], elements: [101, 202, 103, 204, 105, 206, 107, 208, 109, 210, 111, 212]))\n        }\n        \n        do {\n            let a = Tensor(shape: [2, 1, 3, 2], elements: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])\n            let b = Tensor(shape: [3, 2], elements: [100, 200, 300, 400, 500, 600])\n            XCTAssertEqual(a + b, Tensor(shape: [2, 1, 3, 2], elements: [101, 202, 303, 404, 505, 606, 107, 208, 309, 410, 511, 612]))\n            XCTAssertEqual(b + a, Tensor(shape: [2, 1, 3, 2], elements: [101, 202, 303, 404, 505, 606, 107, 208, 309, 410, 511, 612]))\n        }\n    }\n    \n    func testSub() {\n        do {\n            let a = Tensor(shape: [2, 3], elements: [1, 2, 3, 4, 5, 6])\n            let b = Tensor(shape: [2, 3], elements: [12, 11, 10, 9, 8, 7])\n            let r = a - b\n            XCTAssertEqual(r, Tensor(shape: [2, 3], elements: [-11, -9, -7, -5, -3, -1]))\n        }\n        \n        do {\n            let a = Tensor(shape: [2, 3, 2], elements: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])\n            let b = Tensor(shape: [2], elements: [100, 200])\n            XCTAssertEqual(a - b, Tensor(shape: [2, 3, 2], elements: [-99, -198, -97, -196, -95, -194, -93, -192, -91, -190, -89, -188]))\n            XCTAssertEqual(b - a, Tensor(shape: [2, 3, 2], elements: [99, 198, 97, 196, 95, 194, 93, 192, 91, 190, 89, 188]))\n        }\n        \n        do {\n            let a = Tensor(shape: [2, 1, 3, 2], elements: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])\n            let b = Tensor(shape: [3, 2], elements: [100, 200, 300, 400, 500, 600])\n            XCTAssertEqual(a - b, Tensor(shape: [2, 1, 3, 2], elements: [-99, -198, -297, -396, -495, -594, -93, -192, -291, -390, -489, -588]))\n            XCTAssertEqual(b - a, Tensor(shape: [2, 1, 3, 2], elements: [99, 198, 297, 396, 495, 594, 93, 192, 291, 390, 489, 588]))\n        }\n    }\n    \n    func testMul() {\n        do {\n            let a = Tensor(shape: [2, 3], elements: [1, 2, 3, 4, 5, 6])\n            let b = Tensor(shape: [2, 3], elements: [7, 8, 9, 10, 11, 12])\n            XCTAssertEqual(a * b, Tensor(shape: [2, 3], elements: [7, 16, 27, 40, 55, 72]))\n            XCTAssertEqual(b * a, Tensor(shape: [2, 3], elements: [7, 16, 27, 40, 55, 72]))\n        }\n        \n        do {\n            let a = Tensor(shape: [2, 3, 2], elements: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])\n            let b = Tensor(shape: [2], elements: [10, 100])\n            XCTAssertEqual(a * b, Tensor(shape: [2, 3, 2], elements: [10, 200, 30, 400, 50, 600, 70, 800, 90, 1000, 110, 1200]))\n            XCTAssertEqual(b * a, Tensor(shape: [2, 3, 2], elements: [10, 200, 30, 400, 50, 600, 70, 800, 90, 1000, 110, 1200]))\n        }\n        \n        do {\n            let a = Tensor(shape: [2, 1, 3, 2], elements: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])\n            let b = Tensor(shape: [3, 2], elements: [10, 100, 1000, -10, -100, -1000])\n            XCTAssertEqual(a * b, Tensor(shape: [2, 1, 3, 2], elements: [10, 200, 3000, -40, -500, -6000, 70, 800, 9000, -100, -1100, -12000]))\n            XCTAssertEqual(b * a, Tensor(shape: [2, 1, 3, 2], elements: [10, 200, 3000, -40, -500, -6000, 70, 800, 9000, -100, -1100, -12000]))\n        }\n        \n        do {\n            let a = Tensor(shape: [2, 3], elements: [1, 2, 3, 4, 5, 6])\n            let b: Float = 2.0\n            XCTAssertEqual(a * b, Tensor(shape: [2, 3], elements: [2, 4, 6, 8, 10, 12]))\n            XCTAssertEqual(b * a, Tensor(shape: [2, 3], elements: [2, 4, 6, 8, 10, 12]))\n        }\n    }\n    \n    func testDiv() {\n        do {\n            let a = Tensor(shape: [2, 3], elements: [2048, 512, 128, 32, 8, 2])\n            let b = Tensor(shape: [2, 3], elements: [2, 4, 8, 16, 32, 64])\n            XCTAssertEqual(a / b, Tensor(shape: [2, 3], elements: [1024, 128, 16, 2, 0.25, 0.03125]))\n            XCTAssertEqual(b / a, Tensor(shape: [2, 3], elements: [0.0009765625, 0.0078125, 0.0625, 0.5, 4, 32]))\n        }\n        \n        do {\n            let a = Tensor(shape: [2, 3, 2], elements: [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096])\n            let b = Tensor(shape: [2], elements: [8, 2])\n            XCTAssertEqual(a / b, Tensor(shape: [2, 3, 2], elements: [0.25, 2.0, 1.0, 8.0, 4.0, 32.0, 16.0, 128.0, 64.0, 512.0, 256.0, 2048.0]))\n            XCTAssertEqual(b / a, Tensor(shape: [2, 3, 2], elements: [4.0, 0.5, 1.0, 0.125, 0.25, 0.03125, 0.0625, 0.0078125, 0.015625, 0.001953125, 0.00390625, 0.00048828125]))\n        }\n        \n        do {\n            let a = Tensor(shape: [3, 1, 2, 2], elements: [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096])\n            let b = Tensor(shape: [2, 2], elements: [8, 2, -8, -2])\n            XCTAssertEqual(a / b, Tensor(shape: [3, 1, 2, 2], elements: [0.25, 2.0, -1.0, -8.0, 4.0, 32.0, -16.0, -128.0, 64.0, 512.0, -256.0, -2048.0]))\n            XCTAssertEqual(b / a, Tensor(shape: [3, 1, 2, 2], elements: [4.0, 0.5, -1.0, -0.125, 0.25, 0.03125, -0.0625, -0.0078125, 0.015625, 0.001953125, -0.00390625, -0.00048828125]))\n        }\n        \n        do {\n            let a = Tensor(shape:[2, 3], elements: [ 1, 2, 4, 8, 16, 32])\n            let b: Float = 2.0\n            XCTAssertEqual(a / b, Tensor(shape: [2, 3], elements: [0.5, 1, 2, 4, 8, 16]))\n            XCTAssertEqual(b / a, Tensor(shape: [2, 3], elements: [2, 1, 0.5, 0.25, 0.125, 0.0625]))\n        }\n    }\n    \n    func testMatmul() {\n        do {\n            let a = Tensor(shape: [2, 3], elements: [1, 2, 3, 4, 5, 6])\n            let b = Tensor(shape: [3, 4], elements: [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18])\n            let r = a.matmul(b)\n            XCTAssertEqual(r, Tensor(shape: [2, 4], elements: [74, 80, 86, 92, 173, 188, 203, 218]))\n        }\n        do {\n            let a = Tensor(shape: [3, 3], elements: [1, 1, 1, 2, 2, 2, 3, 3, 3])\n            let b = Tensor(shape: [3, 3], elements: [1, 1, 1, 2, 2, 2, 3, 3, 3])\n            let r = a.matmul(b)\n            XCTAssertEqual(r, Tensor(shape: [3, 3], elements: [6, 6, 6, 12, 12, 12, 18, 18, 18]))\n        }\n    }\n    \n    func testMatmulPerformance(){\n        let a = Tensor(shape: [1000, 1000], element: 0.1)\n        let b = Tensor(shape: [1000, 1000], element: 0.1)\n        measure{\n            _ = a.matmul(b)\n        }\n    }\n    \n    static var allTests : [(String, (TensorTests) -> () throws -> Void)] {\n        return [\n            (\"testIndex\", testIndex),\n            (\"testAdd\", testAdd),\n            (\"testSub\", testSub),\n            (\"testMul\", testMul),\n            (\"testDiv\", testDiv),\n            (\"testMatmul\", testMatmul),\n            (\"testMatmulPerformance\", testMatmulPerformance),\n        ]\n    }\n}\n"
  }
]