mirror of
https://github.com/labmlai/annotated_deep_learning_paper_implementations.git
synced 2025-08-14 17:41:37 +08:00
17 lines
372 B
Python
17 lines
372 B
Python
"""
|
|
---
|
|
title: Utility functions for DDPM experiment
|
|
summary: >
|
|
Utility functions for DDPM experiment
|
|
---
|
|
|
|
# Utility functions for [DDPM](index.html) experiemnt
|
|
"""
|
|
import torch.utils.data
|
|
|
|
|
|
def gather(consts: torch.Tensor, t: torch.Tensor):
|
|
"""Gather consts for $t$ and reshape to feature map shape"""
|
|
c = consts.gather(-1, t)
|
|
return c.reshape(-1, 1, 1, 1)
|