hollance / Forge

A neural network toolkit for Metal
MIT License
1.27k stars 173 forks source link

How to implement element wise layer in forge #28

Closed qkxiaohuang closed 6 years ago

qkxiaohuang commented 6 years ago

Hi, I want to convert a caffemodel which includes the elementwise(sum operation) layer, however, there is no implementation in forge, so I want to write it by myself. How to implement this layer as soon as possible? Please help me, thanks!

hollance commented 6 years ago

In Layers.swift, add a new subclass for the layer. Check out the Conv class for how to do this (although you don't need any weights, I suppose). Use the elementwise addition kernel from MPS. It should only be a few lines of code.

qxin commented 6 years ago

Hi..sorry, same question, element wise layer is important (needed by mobileNet v2, resnet...etc