Initialize the matrix parameter follow a Uniform distribution from [-sqrt(6/(fan_in + fan_out)), sqrt(6/(fan_in + fan_out))]. Args: t (Tensor): the parater tensor
(t)
| 207 | |
| 208 | @deprecated(reason="Use glorot_normal") |
| 209 | def xavier(t): |
| 210 | '''Initialize the matrix parameter follow a Uniform distribution from |
| 211 | [-sqrt(6/(fan_in + fan_out)), sqrt(6/(fan_in + fan_out))]. |
| 212 | |
| 213 | Args: |
| 214 | t (Tensor): the parater tensor |
| 215 | ''' |
| 216 | |
| 217 | scale = math.sqrt(6.0 / (t.shape[0] + t.shape[1])) |
| 218 | t.uniform(-scale, scale) |
| 219 | |
| 220 | |
| 221 | @deprecated(reason="Use glorot_uniform") |