classXavier(Initializer): """Initialize the weight with Xavier or similar initialization scheme. Parameters ---------- rnd_type: str, optional Use ```gaussian``` or ```uniform``` to init factor_type: str, optional Use ```avg```, ```in```, or ```out``` to init magnitude: float, optional scale of random number range """ # 若使用上述的 kaiming init method, 设置 rnd_type=gaussian, factor_type='in', # magnitude=2 def__init__(self, rnd_type="uniform", factor_type="avg", magnitude=3): self.rnd_type = rnd_type self.factor_type = factor_type self.magnitude = float(magnitude)