Identity#
- class braintools.init.Identity(scale=1.0, unit=Unit('1'))#
Identity matrix initialization.
Initializes weights to an identity matrix, optionally scaled by a scale factor. For non-square matrices, creates a matrix that is as close to identity as possible.
- Parameters:
scale (
float) – Multiplicative factor to apply to the identity matrix (default: 1.0).
Examples
>>> import numpy as np >>> from braintools.init import Identity >>> >>> init = Identity(scale=1.0) >>> weights = init((100, 100)) >>> >>> # For rectangular matrices >>> weights = init((100, 50)) # Will create identity-like matrix