ComputeLibrary icon indicating copy to clipboard operation
ComputeLibrary copied to clipboard

Implementing Mul and Add layers (BatchNorm) using Graph APIs

Open krgor opened this issue 7 years ago • 3 comments

Hi,

Output of 'strings libarm_compute.so | grep arm_compute_version': arm_compute_version=v18.11 Build options: {'embed_kernels': '1', 'gles_compute': '1', 'logging': '1', 'arch': 'arm64-v8a', 'opencl': '1', 'neon': '1', 'asserts': '1', 'debug': '0', 'os': 'android', 'Werror': '1'} Git hash=3e135c20f49baec9f4c16df11efa6605fa4a7c14

Platform: arm64-v8a

Operating System: Android 7.1

Problem description: I am not able to find the exact similar implementation of Add and Mul mentioned in the below graph node. I have captured this using TensorBoard. screenshot from 2019-01-17 21-19-37

Here in the attached node the input tensor is of 150x150x32 and the output will remain of the same shape. When I extracted the weights from TensorFlow implementation of Add_1 (_97_cf_100) and Mul_1 (_96_cf_99) nodes, they are having one dimension shape of 32. So I can not use those weights in ScaleLayer() as ScaleLayer expects the pixelwise weights not per Channel (just like we have in BatchNormalizationLayer).

I also tried by providing these weights as Mean and Variance to BN layer but it didn't gave proper results.

Can you please help in implementing the mentioned Layers in ACL using Graph APIs? Let me know if you need more info.

Thanks, KGor

krgor avatar Jan 17 '19 16:01 krgor

Hi @krgor Could you please provide more details of the Add and Mul operators you need? Even the links to the operators in the tensorflow online documentation would suffice

Thanks, Manuel

ManubARM avatar Feb 06 '19 15:02 ManubARM

Hi @ManubARM

I could able to resolve it by transposing the weights which were extracted from tensorflow and then passed to ScaleLayer() of Graph APIs.

So tensorflow is having weights in one dimension. I just reshaped as below. data = data.reshape(data.shape[0], 1, 1).copy()

We can close this ticket. Thanks, KGor

krgor avatar Feb 06 '19 16:02 krgor

Thanks @krgor for sharing how you solved the issue

ManubARM avatar Feb 06 '19 16:02 ManubARM