Hi all,
I’d like to define a custom convolutional op by following this: Create an op | TensorFlow Core. I’d ask you: how can I access filter weights in the Compute method? In the call to the REGISTER_OP macro, should I define filter dimensions? Where the weights are updated?
Hi @Gianni_Rossi,
Sorry for the late response. You might have a solution by this time. However some generalized steps are provided here:
- In the custom convolution op, the filter weights are accessed through the input tensors in the compute method like this
auto filter_tensor = filter.tensor<float, 4>();
Please check in the kernel
2. You should define the filter dimensions in the REGISTER_OP macro so that the filters are allocated with some memory.
3. For your custom op you need to define a gradient computation and register as @tf.RegisterGradient.
Thank You