         // Run Metal shaders on the input and fill the output
         let startTime = NSDate()
 
-        // Crop
-        /*if true {
-            let commandBuffer = commandQueue!.commandBuffer()
-            let commandEncoder = commandBuffer.computeCommandEncoder()
-            //let sampleDesc = MTLSamplerDescriptor()
-            //sampleDesc.normalizedCoordinates = true
-            //sampleDesc.minFilter = MTLSamplerMinMagFilter.Linear
-            //sampleDesc.magFilter = MTLSamplerMinMagFilter.Linear
-            //sampleDesc.maxAnisotropy = 16
-            //let sampleState = metalDevice!.newSamplerStateWithDescriptor(sampleDesc)
-            commandEncoder.setComputePipelineState(crop352x288to224State!)
-            commandEncoder.setTexture(input, atIndex: 0)
-            commandEncoder.setTexture(output, atIndex: 1)
-            //commandEncoder.setSamplerState(sampleState, atIndex: 0)
-            let threadsPerThreadgroup = MTLSizeMake(16, 16, 1)
-            let threadgroupsPerGrid = MTLSizeMake(windowSize / threadsPerThreadgroup.width,
-                windowSize / threadsPerThreadgroup.height, 1)
-            commandEncoder.dispatchThreadgroups(threadgroupsPerGrid, threadsPerThreadgroup: threadsPerThreadgroup)
-            commandEncoder.endEncoding()
-            commandBuffer.commit();
-            commandBuffer.waitUntilCompleted()
-        }*/
         let ans = net!.forward(input!)
         let (idx, prob) = argMax(ans)
         let label = "\(net!.labels[idx]) - \(prob*100)%"

        dispatch_async(dispatch_get_main_queue(), {
            self.infoLabel.text = label
        })

        /*if true {
            let commandBuffer = commandQueue!.commandBuffer()
            let commandEncoder = commandBuffer.computeCommandEncoder()
            commandEncoder.setComputePipelineState(float2BGRAState!)
            commandEncoder.setTexture(net!.blobs["data"]!, atIndex: 0)
            commandEncoder.setTexture(outputBGRA, atIndex: 1)
            let threadsPerThreadgroup = MTLSizeMake(16, 16, 1)
            let threadgroupsPerGrid = MTLSizeMake(windowSize / threadsPerThreadgroup.width,
                windowSize / threadsPerThreadgroup.height, 1)
            commandEncoder.dispatchThreadgroups(threadgroupsPerGrid, threadsPerThreadgroup: threadsPerThreadgroup)
            commandEncoder.endEncoding()
            commandBuffer.commit();
            commandBuffer.waitUntilCompleted()
        }*/


        // Copy data from the output texture.
        /*var imageBuf = Array<UInt8>(count: windowSize * windowSize * 4, repeatedValue: 0)
        outputBGRA!.getBytes(&imageBuf, bytesPerRow: windowSize*4,
            fromRegion: MTLRegionMake2D(0, 0, windowSize, windowSize), mipmapLevel: 0)

        let colorSpace = CGColorSpaceCreateDeviceRGB()
        let context = CGBitmapContextCreate(&imageBuf, windowSize, windowSize, 8, 4*windowSize, colorSpace,
            CGImageAlphaInfo.PremultipliedFirst.rawValue | CGBitmapInfo.ByteOrder32Little.rawValue)
        if context == nil {
            print("Could not create context from image buf")
            exit(1)
        }
        let cgImg = CGBitmapContextCreateImage(context)
        if cgImg == nil {
            print("Could not create CGImage from context")
            exit(1)
        }
        let uiImg = UIImage(CGImage:cgImg!, scale: 1, orientation: UIImageOrientation.Up)
        UIImageWriteToSavedPhotosAlbum(uiImg, nil, nil, nil)*/
        // DO NOT FORGET to release cgImg and uiImg.
    }
}

        }
    }

    private func initMetal() {
        engine = Engine()
        net = Net(engine: engine!, config: GoogLeNetConfig(),
            threadsPerThreadgroup: GoogLeNetProfile.GetThreadsPerThreadgroup())
        metalDevice = MTLCreateSystemDefaultDevice()
        CVMetalTextureCacheCreate(kCFAllocatorDefault, nil, metalDevice!, nil, &textureCache)

        // init output texture
        let outputDesc = MTLTextureDescriptor()
