I’m building a new custom layer in MXNet, it has to work both with gluon and symbolic API.
Custom layer needs to access to weights of the previous layer. In custom layer I have an instance reference of the previous layer as I pass the reference in the class constructor.
I can obtain weights as follows:
kernel = self.layer.collect_params().get('weight')
but I got the following error:
AssertionError: Argument data must be Symbol instances, but got Parameter dense0_weight (shape=(256, 61), dtype=float32)
It works fine with the gluon api
kernel = self.layer.weight.data() but I need it to make it works in the symbolic api as well. Please be aware that self.layer does not refer to the current custom layer but it’s a reference for the previous layer in a HybridSequential.
Do you guys have any hints?