mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-01-14 14:07:55 -05:00
13 lines
258 B
Python
13 lines
258 B
Python
from typing import TypeVar
|
|
|
|
import torch
|
|
|
|
T = TypeVar("T", bound=torch.nn.Module)
|
|
|
|
|
|
def zero_module(module: T) -> T:
|
|
"""Initialize the parameters of a module to zero."""
|
|
for p in module.parameters():
|
|
torch.nn.init.zeros_(p)
|
|
return module
|