I’m building a gluon HyrbidBlock with I need it work both with imperative and symbolic API.
In my hybrid_forward method, I need to sample from a random uniform distribution with a given shape:
unif_noise = f.uniform(shape=(x.shape))
The problem here, is that it doesn’t work when I hybridize the network because the symbolic API dosn’t have the shape attribute for tensors. A possible workaround could be using fixed dimensions for the
x input vector, like:
unif_noise = f.uniform(shape=(None, self.dimension))
self.dimension is well-known. The first dimension of that tuple represents the batch size, which I don’t know and cannot infer “a priori”. Both placeholders
-1 didn’t work.
Do you guys know a workaround?