I have a network that I coded using regular Blocks. It works, but, the performance is extremly slow!
So, I am in the process of converting the code to use HybridBlocks in the hope that it would result in faster learning. But, I am stuck trying to figure out how to go about writing the equivalent HybridBlock code. Let me reproduce a tiny part.
def hybrid_forward(self, F, input):
# former regular Block code that needs to be changed for HybridBlock
numInputs = input.shape[0]
blah = input.slice_axis(axis=1, begin=self.numInputs-1, end=self.numInputs).reshape((numInputs,))
scaledBlah = blah * self.scale
temp = nd.array(scaledBlah.floor() % self.scale)
But, after hybridize() call, the very first statement there itself triggers the error saying "AttributeError: ‘Symbol’ object has no attribute ‘shape’ ".
Can someone please tell me how can code lines such as the above be changed so that they are OK for HybridBlock?
Thanks!