Custom convolution function in tensorflow

I want to use my own convolution function in tensorflow. I have implemented this with numpy. How to convert code to Tensorflow format (dynamic inputs to a computational graph).

Currently my function takes a 2d numpy array as input and creates a 3d numpy array (height, width and output channels). How can I iterate over all input images?

+3


source to share


1 answer


What you want doesn't make sense. Convolution is a mathematical operation that is defined in a certain way. It expands easily in N-dimensions and converts to the discrete case (summing instead of integrating), so TF has conv1d, conv2d, and a common n-dimensional convolution.

Thus, it is not possible to define my own convolution function

in the same way that you cannot define your own matrix multiplication function, because if it does not calculate values ​​in the exact same way, it will no longer be a convolution function.




Now, if you want to define your own operation, you should look at the official documentation on how to define it . In a few words:

  • create an op using already written functions
  • write stuff in C ++
0


source







All Articles