MCPcopy Create free account
hub / github.com/csslc/PiSA-SR / build_task_queue

Function build_task_queue

src/my_utils/vaehook.py:331–358  ·  view source on GitHub ↗

Build a single task queue for the encoder or decoder @param net: the VAE decoder or encoder network @param is_decoder: currently building decoder or encoder @return: the task queue

(net, is_decoder)

Source from the content-addressed store, hash-verified

329
330
331def build_task_queue(net, is_decoder):
332 """
333 Build a single task queue for the encoder or decoder
334 @param net: the VAE decoder or encoder network
335 @param is_decoder: currently building decoder or encoder
336 @return: the task queue
337 """
338 task_queue = []
339 task_queue.append(('conv_in', net.conv_in))
340
341 # construct the sampling part of the task queue
342 # because encoder and decoder share the same architecture, we extract the sampling part
343 build_sampling(task_queue, net, is_decoder)
344 if is_decoder and not sd_flag:
345 net.give_pre_end = False
346 net.tanh_out = False
347
348 if not is_decoder or not net.give_pre_end:
349 if sd_flag:
350 task_queue.append(('pre_norm', net.norm_out))
351 else:
352 task_queue.append(('pre_norm', net.conv_norm_out))
353 task_queue.append(('silu', inplace_nonlinearity))
354 task_queue.append(('conv_out', net.conv_out))
355 if is_decoder and net.tanh_out:
356 task_queue.append(('tanh', torch.tanh))
357
358 return task_queue
359
360
361def clone_task_queue(task_queue):

Callers 1

vae_tile_forwardMethod · 0.85

Calls 1

build_samplingFunction · 0.85

Tested by

no test coverage detected