How to make a Flatten filter using MPS (MetalPerformanceShaders)?

I am working on doing CNN output for MNIST on iOS. For starters, there's a good sample of code from Apple. https://developer.apple.com/library/content/samplecode/MPSCNNHelloWorld/Introduction/Intro.html#//apple_ref/doc/uid/TP40017482-Intro-DontLinkElementID_2

However, when I tried to implement a much complex CNN model (e.g. https://github.com/fchollet/keras/blob/master/examples/mnist_cnn.py ) using MPS, I found that there was no class for the Flatten filter "

I looked through the MPS structure to find a function to change or change the dimension, but I could not find the correct one. (e.g. MPSImageConversion is presented only for color conversion, but not for measurement.

If someone knows a filter for Flatten or how to convert a multidimensional image to a one-dimensional image, let me know.

+6
source share
1 answer

A Flatten layer is not required because the MPS can process multidimensional data as input.

0
source

Source: https://habr.com/ru/post/1012669/


All Articles