Hi ,
I want to add epsilon in BatchNorm which is not a constant instead exp(-mul(x,x)).
where x is the weights should be batchnormed.
But seems that nn.BatchNorm only accept a constant as epsilon
I tyr to :
1:
class Guassian_Batchnorm(BatchNorm):
def __init__(self):
super(Guassian_Batchnorm, self).__init__()
def hybrid_forward(self, F, x, gamma, beta, running_mean, running_var):
eps = F.exp(-F.elemwise_mul(x, x))
return F.BatchNorm(x, gamma, beta, running_mean, running_var, eps,
name='fwd', **self._kwargs)
2:
class Guassian_Batchnorm(BatchNorm):
def __init__(self):
super(Guassian_Batchnorm, self).__init__()
module.add(nn.BatchNorm(out_channels,epsilon=Gaussian()))
Both of them get errors:
ValueError: Deferred initialization failed because shape cannot be inferred. BatchNorm() got multiple values for argument ‘eps’ for 1
ValueError: Deferred initialization failed because shape cannot be inferred. Invalid Parameter format for eps expect double but value=‘Gaussian()’, in operator BatchNorm(name="", axis=“64”, fix_gamma=“False”, momentum=“0.9”, use_global_stats=“False”, eps=“Gaussian()”) for 2
How to do that?
thank you for your time and considerations.