LinearRule
LinearRule()Rule for nn.Linear on inputs [N, D] or [N, *positions, D].
T is the product of the position sizes (1 for [N, D]) and G is 1.
Methods
| Name | Description |
|---|---|
| check | Refuse a module that isn’t nn.Linear and inputs with fewer than 2 dimensions. |
| grads | The output gradient as [N, T, D_out]. |
| inputs | The input as [N, T, 1, D_in]. |
check
LinearRule.check(module, x, name, /)Refuse a module that isn’t nn.Linear and inputs with fewer than 2 dimensions.
grads
LinearRule.grads(module, g, /)The output gradient as [N, T, D_out].
inputs
LinearRule.inputs(module, x, /)The input as [N, T, 1, D_in].