Skip to content

Composing flow transformations #17

Answered by francois-rozet
minaskar asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @minaskar, thank you for your questions!

Is there currently a way to "stack" and train different flows at the same time?

In Zuko, a flow is an instance of the Flow class and has two attributes: transform and base. To create a flow, you can either instantiate one of the built-in ones (MAF, NSF, ...) or compose your own as a Flow subclass. For instance, if you want one affine autoregressive transformation and one spline coupling transformation:

import torch
import zuko

class MyFlow(zuko.flows.Flow):
    def __init__(self, features: int, context: int = 0):
        transforms = [
            zuko.flows.MaskedAutoregressiveTransform(
                features,
                context,
…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@minaskar
Comment options

Answer selected by francois-rozet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants