Last active
August 12, 2019 10:27
-
-
Save dneprDroid/edfe3c32f7de102dd43ed432ad25e032 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func buildGraph(device: MTLDevice) -> MPSNNGraph { | |
| let inputNode = MPSNNImageNode() | |
| let node1 = SomeNode1(input: inputNode, weights: ...) | |
| let node2 = SomeNode2(input: node1.resultImage, weights: ...) | |
| let node3 = SomeNode3(input: node2.resultImage, weights: ...) | |
| ..... | |
| return MPSNNGraph(device: device, | |
| resultImage: nodeN.resultImage) | |
| } | |
| .... | |
| let device = MTLCreateSystemDefaultDevice() | |
| let graph = buildGraph(device: device) | |
| graph.executeAsync(withSourceImages: [inputImage]) { outputImage, error in | |
| // parse data from outputImage | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment