Closed dongwu92 closed 7 years ago
You cannot write a class that is used in place of MPSCNNNeuron* because MPS does special magic to make that work. So the Relu6 would need to be a layer of its own. I can probably put an example together tomorrow (it's easier than you might think :smile: )
Thank you very much!
This is the shader code (not tested so may have typos): https://gist.github.com/hollance/aced12033f286f9af920f3914b9d214e
You'll still need to write the code to load this Metal function in Swift and call it. For an example of how to do this, see the SubtractMeanColor.swift file in this repo.
Thank you!
Could you please write a swift class of Relu6 to replace MPSCNNNeuronReLU? I'm new with Metal and want to get a example to define new layers except kinds of Convolutions. Thank you very much! Relu6 in tensorflow get f(x;a)=min(a*min(0, x)+max(0, x), 6)