MCPcopy Create free account
hub / github.com/huggingface/diffusers / Timesteps

Class Timesteps

src/diffusers/models/embeddings.py:1309–1325  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1307
1308
1309class Timesteps(nn.Module):
1310 def __init__(self, num_channels: int, flip_sin_to_cos: bool, downscale_freq_shift: float, scale: int = 1):
1311 super().__init__()
1312 self.num_channels = num_channels
1313 self.flip_sin_to_cos = flip_sin_to_cos
1314 self.downscale_freq_shift = downscale_freq_shift
1315 self.scale = scale
1316
1317 def forward(self, timesteps: torch.Tensor) -> torch.Tensor:
1318 t_emb = get_timestep_embedding(
1319 timesteps,
1320 self.num_channels,
1321 flip_sin_to_cos=self.flip_sin_to_cos,
1322 downscale_freq_shift=self.downscale_freq_shift,
1323 scale=self.scale,
1324 )
1325 return t_emb
1326
1327
1328class GaussianFourierProjection(nn.Module):

Callers 15

__init__Method · 0.90
_set_time_projMethod · 0.90
_set_add_embeddingMethod · 0.90
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…