Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/DPS2022/diffusion-posterior-sampling
/ functions
Functions
290 in github.com/DPS2022/diffusion-posterior-sampling
⨍
Functions
290
◇
Types & classes
58
↓ 16 callers
Method
transpose
(self, data, **kwargs)
guided_diffusion/measurements.py:42
↓ 14 callers
Function
conv_nd
Create a 1D, 2D, or 3D convolution module.
guided_diffusion/nn.py:22
↓ 14 callers
Function
extract_and_expand
(array, time, target)
guided_diffusion/posterior_mean_variance.py:248
↓ 13 callers
Function
extract_and_expand
(array, time, target)
guided_diffusion/gaussian_diffusion.py:463
↓ 11 callers
Method
__init__
Initialize the GANLoss class. Parameters: gan_mode (str) - - the type of GAN objective. It currently supports vanilla, lsgan, an
guided_diffusion/unet.py:1021
↓ 7 callers
Function
normalization
Make a standard normalization layer. :param channels: number of input channels. :return: an nn.Module for normalization.
guided_diffusion/nn.py:93
↓ 5 callers
Function
linear
Create a linear module.
guided_diffusion/nn.py:35
↓ 4 callers
Method
_wrap_model
(self, model)
guided_diffusion/gaussian_diffusion.py:336
↓ 4 callers
Function
clear_color
(x)
util/img_utils.py:45
↓ 4 callers
Function
fftshift
Similar to np.fft.fftshift but applies to PyTorch Tensors Args: x: A PyTorch tensor. dim: Which dimension to fftshift. Re
util/fastmri_utils.py:163
↓ 4 callers
Method
forward
(self, x)
guided_diffusion/nn.py:13
↓ 4 callers
Function
ifftshift
Similar to np.fft.ifftshift but applies to PyTorch Tensors Args: x: A PyTorch tensor. dim: Which dimension to ifftshift.
util/fastmri_utils.py:186
↓ 4 callers
Function
normalize_np
Normalize img in arbitrary range to [0, 1]
util/tools.py:20
↓ 4 callers
Function
zero_module
Zero out the parameters of a module and return it.
guided_diffusion/nn.py:68
↓ 3 callers
Method
__init__
(self, betas, dynamic_threshold, clip_denoised)
guided_diffusion/posterior_mean_variance.py:32
↓ 3 callers
Function
load_yaml
(file_path: str)
sample_condition.py:19
↓ 3 callers
Function
normalize_np
Normalize img in arbitrary range to [0, 1]
util/img_utils.py:52
↓ 3 callers
Method
process_xstart
(self, x)
guided_diffusion/posterior_mean_variance.py:40
↓ 2 callers
Method
__init__
(self, operator, noiser, **kwargs)
guided_diffusion/condition_methods.py:80
↓ 2 callers
Method
_compute_norms
(self, grad_scale=1.0)
guided_diffusion/fp16_util.py:214
↓ 2 callers
Method
_retrieve_box
(self, img)
util/img_utils.py:193
↓ 2 callers
Function
bbox2mask
(bboxes, height, width, max_delta_h, max_delta_w)
util/tools.py:144
↓ 2 callers
Function
checkpoint
Evaluate a function without caching intermediate activations, allowing for reduced memory at the expense of extra compute in the backward pas
guided_diffusion/nn.py:124
↓ 2 callers
Function
count_flops_attn
A counter for the `thop` package to count the operations in an attention operation. Meant to be used like: macs, params = thop.pr
guided_diffusion/unet.py:379
↓ 2 callers
Method
forward
(self, data, **kwargs)
guided_diffusion/measurements.py:37
↓ 2 callers
Method
forward
(self, in_tensor)
util/resizer.py:55
↓ 2 callers
Function
get_param_groups_and_shapes
(named_model_params)
guided_diffusion/fp16_util.py:80
↓ 2 callers
Method
grad_and_value
(self, x_prev, x_0_hat, measurement, **kwargs)
guided_diffusion/condition_methods.py:28
↓ 2 callers
Function
make_master_params
Copy model parameters into a (differently-shaped) list of full-precision parameters.
guided_diffusion/fp16_util.py:33
↓ 2 callers
Method
p_mean_variance
( self, model, *args, **kwargs )
guided_diffusion/gaussian_diffusion.py:320
↓ 2 callers
Method
project
(self, data, noisy_measurement, **kwargs)
guided_diffusion/condition_methods.py:25
↓ 2 callers
Function
random_bbox
Generate a random tlhw with configuration. Args: config: Config should have configuration including img Returns: tuple: (top
util/tools.py:106
↓ 2 callers
Function
roll
Similar to np.roll but applies to PyTorch Tensors. Args: x: A PyTorch tensor. shift: Amount to roll. dim: Which dimen
util/fastmri_utils.py:140
↓ 2 callers
Function
timestep_embedding
Create sinusoidal timestep embeddings. :param timesteps: a 1-D Tensor of N indices, one per batch element. These may b
guided_diffusion/nn.py:103
↓ 2 callers
Method
transpose
(self, data, **kwargs)
guided_diffusion/measurements.py:83
↓ 2 callers
Function
unflatten_master_params
(param_group, master_param)
guided_diffusion/fp16_util.py:76
↓ 2 callers
Method
update_weights
(self, k)
util/img_utils.py:294
↓ 2 callers
Function
zero_master_grads
(master_params)
guided_diffusion/fp16_util.py:126
↓ 1 callers
Method
__init__
(self, model, timestep_map, rescale_timesteps, original_num_steps)
guided_diffusion/gaussian_diffusion.py:349
↓ 1 callers
Method
__init__
(self, img_size=256, crop_size=128, stride=64)
util/img_utils.py:144
↓ 1 callers
Method
_optimize_fp16
(self, opt: th.optim.Optimizer)
guided_diffusion/fp16_util.py:187
↓ 1 callers
Method
_optimize_normal
(self, opt: th.optim.Optimizer)
guided_diffusion/fp16_util.py:207
↓ 1 callers
Method
_retrieve_random
(self, img)
util/img_utils.py:204
↓ 1 callers
Method
_scale_timesteps
(self, t)
guided_diffusion/gaussian_diffusion.py:235
↓ 1 callers
Function
avg_pool_nd
Create a 1D, 2D, or 3D average pooling module.
guided_diffusion/nn.py:42
↓ 1 callers
Function
betas_for_alpha_bar
Create a beta schedule that discretizes the given alpha_t_bar function, which defines the cumulative product of (1-beta) over time from t = [
guided_diffusion/gaussian_diffusion.py:440
↓ 1 callers
Function
check_overflow
(value)
guided_diffusion/fp16_util.py:233
↓ 1 callers
Function
compute_color
(u, v)
util/tools.py:372
↓ 1 callers
Method
contributions
(self, in_length, out_length, scale, kernel, kernel_width, antialiasing)
util/resizer.py:104
↓ 1 callers
Method
convert_to_fp16
Convert the torso of the model to float16.
guided_diffusion/unet.py:689
↓ 1 callers
Function
create_gaussian
Return a Gaussian
util/img_utils.py:351
↓ 1 callers
Function
create_model
( image_size, num_channels, num_res_blocks, channel_mult="", learn_sigma=False, class_
guided_diffusion/unet.py:25
↓ 1 callers
Function
create_sampler
(sampler, steps, noise_schedule, model_mean_type,
guided_diffusion/gaussian_diffusion.py:31
↓ 1 callers
Function
dynamic_thresholding
(img, s=0.95)
util/img_utils.py:240
↓ 1 callers
Function
fft2_m
FFT for multi-coil
util/img_utils.py:26
↓ 1 callers
Function
fft2c_new
Apply centered 2 dimensional Fast Fourier Transform. Args: data: Complex valued input data containing at least 3 dimensions:
util/fastmri_utils.py:67
↓ 1 callers
Method
fix_scale_and_size
(self, input_shape, output_shape, scale_factor)
util/resizer.py:76
↓ 1 callers
Method
forward
(self, x)
guided_diffusion/unet.py:171
↓ 1 callers
Method
forward
(self, data, **kwargs)
guided_diffusion/measurements.py:80
↓ 1 callers
Method
forward
(self, data, **kwargs)
guided_diffusion/measurements.py:142
↓ 1 callers
Method
forward
(self, data, **kwargs)
guided_diffusion/measurements.py:157
↓ 1 callers
Method
forward
(self, data)
guided_diffusion/measurements.py:229
↓ 1 callers
Function
get_conditioning_method
(name: str, operator, noiser, **kwargs)
guided_diffusion/condition_methods.py:14
↓ 1 callers
Function
get_dataloader
(dataset: VisionDataset, batch_size: int, num_workers: int,
data/dataloader.py:25
↓ 1 callers
Function
get_dataset
(name: str, root: str, **kwargs)
data/dataloader.py:19
↓ 1 callers
Method
get_kernel
(self)
guided_diffusion/measurements.py:110
↓ 1 callers
Function
get_logger
()
util/logger.py:3
↓ 1 callers
Method
get_mean_and_xstart
(self, x, t, model_output)
guided_diffusion/posterior_mean_variance.py:37
↓ 1 callers
Function
get_mean_processor
(name: str, **kwargs)
guided_diffusion/posterior_mean_variance.py:24
↓ 1 callers
Function
get_named_beta_schedule
Get a pre-defined beta schedule for the given name. The beta schedule library consists of beta schedules which remain similar in the lim
guided_diffusion/gaussian_diffusion.py:413
↓ 1 callers
Function
get_noise
(name: str, **kwargs)
guided_diffusion/measurements.py:217
↓ 1 callers
Function
get_operator
(name: str, **kwargs)
guided_diffusion/measurements.py:29
↓ 1 callers
Function
get_sampler
(name: str)
guided_diffusion/gaussian_diffusion.py:25
↓ 1 callers
Method
get_target_tensor
Create label tensors with the same size as the input. Parameters: prediction (tensor) - - tpyically the prediction from a discrim
guided_diffusion/unet.py:1045
↓ 1 callers
Function
get_var_processor
(name: str, **kwargs)
guided_diffusion/posterior_mean_variance.py:145
↓ 1 callers
Method
get_variance
(self, x, t)
guided_diffusion/posterior_mean_variance.py:156
↓ 1 callers
Function
ifft2c_new
Apply centered 2-dimensional Inverse Fast Fourier Transform. Args: data: Complex valued input data containing at least 3 dimensions:
util/fastmri_utils.py:92
↓ 1 callers
Function
main
()
sample_condition.py:25
↓ 1 callers
Function
make_color_wheel
()
util/tools.py:434
↓ 1 callers
Function
master_params_to_model_params
Copy the master parameter data back into the model parameters.
guided_diffusion/fp16_util.py:63
↓ 1 callers
Function
master_params_to_state_dict
( model, param_groups_and_shapes, master_params, use_fp16 )
guided_diffusion/fp16_util.py:93
↓ 1 callers
Function
model_grads_to_master_grads
Copy the gradients from the model parameters into the master parameters from make_master_params().
guided_diffusion/fp16_util.py:50
↓ 1 callers
Function
normalize
(img, s=0.95)
util/img_utils.py:235
↓ 1 callers
Method
ortho_project
(self, data, **kwargs)
guided_diffusion/measurements.py:46
↓ 1 callers
Method
p_sample
(self, model, x, t)
guided_diffusion/gaussian_diffusion.py:209
↓ 1 callers
Function
param_grad_or_zeros
(param)
guided_diffusion/fp16_util.py:139
↓ 1 callers
Function
pil_loader
(path)
util/tools.py:27
↓ 1 callers
Method
predict_eps_from_x_start
(self, x_t, t, pred_xstart)
guided_diffusion/gaussian_diffusion.py:403
↓ 1 callers
Method
predict_xstart
(self, x_t, t, x_prev)
guided_diffusion/posterior_mean_variance.py:58
↓ 1 callers
Method
predict_xstart
(self, x_t, t, eps)
guided_diffusion/posterior_mean_variance.py:120
↓ 1 callers
Method
prepare_nonlinear_blur_model
Nonlinear deblur requires external codes (bkse).
guided_diffusion/measurements.py:180
↓ 1 callers
Function
pt_compute_color
(u, v)
util/tools.py:401
↓ 1 callers
Function
pt_make_color_wheel
()
util/tools.py:465
↓ 1 callers
Method
pxt_given_x0
(self, x0, xt, t, verbose=False)
util/img_utils.py:319
↓ 1 callers
Method
py_given_x0
(self, x0, y, A, verbose=False)
util/img_utils.py:311
↓ 1 callers
Method
q_posterior_mean
Compute the mean of the diffusion posteriro: q(x_{t-1} | x_t, x_0)
guided_diffusion/posterior_mean_variance.py:79
↓ 1 callers
Method
q_posterior_mean
Compute the mean of the diffusion posteriro: q(x_{t-1} | x_t, x_0)
guided_diffusion/posterior_mean_variance.py:110
↓ 1 callers
Method
q_sample
Diffuse the data for a given number of diffusion steps. In other words, sample from q(x_t | x_0). :param x_start: the initi
guided_diffusion/gaussian_diffusion.py:129
↓ 1 callers
Function
random_sq_bbox
Generate a random sqaure mask for inpainting
util/img_utils.py:157
↓ 1 callers
Function
reshape_patch
(x, crop_size=128, dim_size=3)
util/img_utils.py:93
next →
1–100 of 290, ranked by callers