{'fraction_non_alphanumeric': 0.03212199870214147, 'fraction_numerical': 0.006046840894342517, 'mean_word_length': 5.039009618810118, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Pixyz: a library for developing deep generative models

With the recent rapid progress in the study of deep generative models (DGMs), there is a need for a framework that can implement them in a simple and generic way. In this research, we focus on two features of DGMs: (1) deep neural networks are encapsulated by probability distributions and (2) models are designed and learned based on an objective function. Taking these features into account, we propose a new DGM library called Pixyz. This library adopts a step-by-step implementation method with three APIs, which allows us to implement various DGMs more concisely. In addition, the library introduces memoization to reduce the cost of duplicate computations in DGMs to speed up the computation. We demonstrate experimentally that this library is faster than existing probabilistic programming languages in training DGMs.


Introduction
Artificial intelligence has made great progress in recent years through deep learning [21]. Among the various trends in deep learning, deep generative models (DGMs) (i.e., generative models based on deep neural networks (DNNs)) have been the focus of significant attention [7-9, 15, 17, 18, 30, 34, 39]. Generative models represent the process of generating data, whereas DGMs can also handle high-dimensional data with more complex dependencies that cannot be handled by conventional probabilistic models. Therefore, they can be used to learn generative models of images [28] and text [3], generate them, and infer from them to obtain good representations. In addition, they can be used for anomaly detection [32], out-of-distribution detection [23], transformation between modalities [35], and learning larger datasets from the environment to acquire models of the environment for reinforcement learning [11,12].
There are various types of DGMs, such as variational autoencoders (VAEs) [18,30], generative adversarial networks (GANs) [9], and flow-based models [7,17], and many models based on each have been proposed so far. Although the implementations of these studies often use deep learning libraries such as PyTorch [26] or Tensorflow [6], they are implemented in their own unique ways. Therefore, their code is often difficult to understand due to their unique designs. The lack of a unified implementation format is also a problem in terms of maintenance.
Probabilistic programming languages (PPLs) [38] are known as languages for constructing computational graphs of probabilistic models and inferring the posterior distribution of arbitrary variables in those models from observed data. They provide a unified framework for building and inferring probabilistic models. More recently, Pyro [1], PyMC3 [31], and TensorFlow Probability [6] (including Edward [37]) have been developed as PPLs that can build part of the computational graph of a probabilistic model in DNNs. These PPLs can benefit from Graphics Processing Unit (GPU) acceleration by using PyTorch or Tensorflow as their host language.
Despite their flexibility and scalability, PPLs are rarely used in practice as a library for implementing DGMs. We hypothesize that this is because DGMs' characteristics differ from those of traditional (non-deep) probabilistic models. Specifically, we focus on two inherent features of DGMs: (1) DNNs are encapsulated by probability distributions and (2) models are designed and learned based on an objective function.
In this study, we propose a novel DGM framework called Pixyz 1 that is based on the above features of DGMs that introduces a step-by-step implementation scheme according to three new APIs: Distribution API, Loss API, and Model API (see Figure 1). These APIs have a hierarchical relationship, with the higher-level API encapsulating the implementation of the lower-level API.
Distribution API supports the construction of distribution classes by means of DNNs, taking into account the first feature of DGMs described above. Using the instances obtained from each distribution class, we can perform sampling and likelihood estimation in the same framework, regardless of the form of neural network is used in them. In addition, joint distributions can be represented by the intuitive operation of multiplying conditional distributions constructed by Distribution API, and sampling and likelihood estimation can be performed on these as well.
Loss API is the most distinctive and original API in Pixyz, allowing us to intuitively define the objective function corresponding to the model being implemented from the probability distribution constructed by Distribution API. In conventional PPLs, the optimization method and the objective function are considered identical; therefore, it is difficult to freely design the objective function. Pixyz, on the other hand, solves this problem by separating the definition of the objective function and optimization method, with the former handled by Loss API and the latter by Model API, an upper-layer API of Loss API. In this way, each API in Pixyz is designed to consider the different characteristics of DGMs, thereby enabling flexible implementation and learning of DGMs.
We have also devised speedups in Pixyz. VAEs, representative models among DGMs, require multiple inferences based on the same inference model to be performed on the objective function, which increases the computational cost of the objective function if implemented in a straightforward manner. Pixyz utilizes caching to memoize the results of inference once performed on an input and use them for the second and subsequent inference runs on the same input, thereby achieving high-speed processing.
The paper is organized as follows. We first explain the difference between DGMs and conventional probabilistic generative models, and then explain the difficulties in implementing them in existing PPLs. Next, we introduce Pixyz and explain how it solves this difficulty. We then explain the learning acceleration method by memoization on Pixyz. In our experiments, we compare the execution time of DGMs implemented in Pixyz and Pyro and show that Pixyz is faster at training DGMs. Finally, we discuss Pixyz's current challenges and future prospects.

Background: Deep Generative Models
In the generative model framework, the given data x is assumed to be generated from the true data distribution p data (x), and a probabilistic model p θ (x) (where θ is a parameter of the probabilistic model) is learned to approximate it. This probabilistic model is called a generative model because it models the generative process of the observed variables.
In general, a generative model assumes that the latent variable z is an unobserved factor behind the observed variable; that is, (1) In such a generative model with multiple random variables, conditional independence between different variables (i.e., dependency between them), which we call design of generative models in this paper, is assumed. For example, we assume that the conditional independence of a generative model with an observed variable x and a latent variable z is which means that we design the model such that the probability distribution of the observed variable x depends on the latent variable z. Such conditional independence can be represented as a graphical model. After learning the generative model, sampling x ∼ p θ (x) can be performed to generate new data. For generative models with latent variables, we can generate samples by ancestral sampling, such as z ∼ p θ (z) and x ∼ p θ (x|z). In addition, estimating the posterior distribution over the latent variable p θ (z|x), or inference, is also an important task in generative models 1 .
Conventionally, simple probability distributions that are easy to calculate are used to construct generative models. However, such models cannot capture the distribution of input data with high dimensionality and complex dependencies among dimensions, such as natural images. Therefore, instead of dealing directly with high-dimensional data, these generative models often use these preprocessed low-dimensional features as input; thus, they are mainly used to infer latent variables from the data rather than to generate it.
DGMs can directly capture the distribution of data with such complex dependencies by representing the probability distribution in DNNs. This makes it possible to learn and generate high-resolution natural images, which was not possible with conventional generative models [28].
Known types of DGMs include VAEs [18,30], GANs [9], and flow-based models [7,17]. Compared with conventional generative models, these models have the following common features: (1) DNNs are encapsulated by probability distributions. As mentioned above, probability distributions in DGMs are represented by DNNs; however, the manner of this representation differs depending on the model. For example, in VAEs, the parameter λ of arbitrary distribution family g(x; λ) 2 is represented as the output of a DNN f θ with z as input, which is considered to define the conditional distribution p θ (x|z) 3 : In GANs, the forward propagation from z to x through a DNN f θ is considered a sample from the conditional distribution p θ (x|z): Furthermore, in flow-based models, p θ (x) is defined as the change of variables by an invertible transformation (called flow) f θ to the base distribution p 0 (z) over z: In DGMs, probability distributions represented by DNNs are used as components to design probabilistic models. In this design process, the focus of attention is often not the specific structure of DNNs but the relationship between the random variables. For example, most studies of VAEs, which are latent variable models, explain the conditional independence of observed and latent variables for each model in graphical models (Figure 3, left). However, in actual implementations, each edge of the graphical model (i.e., each probability distribution) is represented by a neural network ( Figure 3, right), and they are often written in separate sections or appendices to the graphical model description in the paper.
(2) Models are designed and learned based on the objective function. Many existing generative models perform parameter learning (estimation) based on sampling methods. On the other hand, all DGMs are learned by optimizing the objective function end-to-end based on backpropagation. The objective function differs for each model; for example, the objective function of VAEs is the evidence lower bound (ELBO) of the marginal log-likelihood log p θ (x) of given data x: where q φ (z|x) is an approximated posterior distribution (or inference model). The first term in Equation (6) represents the negative reconstruction error due to the inference model q φ (z|x) and the generative model p θ (x|z), and the second term represents the regularization of the inference model by the prior p(z). Besides that, the objective function of GANs is the Jensen-Shannon divergence between the data distribution and the generative model (which requires the introduction of a discriminative model and adversarial learning), and that of the flow-based models is the marginal log-likelihood of given data (which is equivalent to the Kullback-Leibler divergence between them). In addition, in DGMs, regularization of latent variables (or representations) is often imposed as a regularization term in the objective function. For example, in VAEs, increasing the regularization term in Equation (6) leads to disentangled representations [14].
From these facts, the definition of the objective function also plays an important role in the design of DGMs, which is another major difference from existing generative models.
Based on these features, we next discuss the challenges in implementing DGMs in existing probabilistic modeling libraries.

Related works
Existing PPLs have been designed with fast and various sampling algorithms for inference (and learning). For example, Stan [4] is written in C++ and is characterized by its fast-sampling capability. Currently, Tensorflow Probability [6] (Edward [37]) and Pyro [1] can be run on Python and GPU-accelerated libraries such as TensorFlow [6] and PyTorch [26]; therefore, they enable the implementation of probabilistic models with DNNs and their fast sampling, inference, and training on GPUs.
Although these general-purpose PPLs can implement many deep probabilistic models, they are rarely used to implement complex DGMs. We consider that this is because these libraries' ability to implement such DGMs is limited.
First, existing PPLs treat DNNs and probability distributions equally and thus do not officially support the encapsulation of DNNs into probability distributions; thus, it is difficult for them to satisfy the first feature of DGMs.
Pyro, a PyTorch-based PPL, allows us to write the generative process of multiple random variables in a Python method, and then use methods such as trace, condition, and block included in pyro.poutine to calculate the likelihood of its joint distribution and its conditional distribution given arbitrary variables. In a sense, these functions realize the concealment referred to above. However, the form of the instances generated by them differs from that of the instances of the original probability distribution class, so they can no longer be sampled or their likelihood estimated in the same way. If the joint probability distributions are designed such that p(x, y) = p(x|y)p(y), we believe that sampling and likelihood calculations from p(y), p(x|y), and p(x, y) should be treated in the same way. There is also a concern that the above Pyro implementation of joint and conditional distributions may be somewhat counterintuitive in the sense that multiple additional methods are required.
Tensorflow Probability, a Tensorflow-based PPL, includes the JointDistributionSequential class [27] to solve the problem of defining joint distributions, which generates joint distribution instances with a list of generative processes as arguments. These instances can perform sampling and likelihood estimation in the same way as other probability distributions. This advantage is similar to the Pixyz distribution API proposed in this paper; however, Pixyz is more intuitive because it can construct the joint distribution as a product of distributions encapsulating DNNs 1 .  Second, many probabilistic programming libraries do not allow the flexible definition of objective functions, which means they are difficult to satisfy the second feature. This is because, as discussed in Section 2, the design and learning of DGMs differs greatly from those of existing probabilistic models, and many probabilistic modeling libraries support the implementation of such general probabilistic models. Although some deep probabilistic modeling libraries [1,37] support implementations such as VAEs and GANs, they are pre-designed as classes for learning and thus their objective functions cannot be defined flexibly.
Probabilistic Torch (ProbTorch) [33] is the closest library to Pixyz proposed in this study. ProbTorch is a library dedicated to the implementation of DGMs, and can be implemented considering the first feature of DGMs, which are common to Pixyz. However, Pixyz has the great advantage of being able to directly implement products of probability distributions, objective functions, etc., which ProbTorch lacks. In addition, while ProbTorch is mainly designed to implement VAEs, Pixyz can easily implement not only VAEs but also GANs, flow-based models, and complex DGMs that combine them.

Proposed library: Pixyz
In this section, we describe our proposed library, Pixyz, which is based on Python and uses Py-Torch to design DNNs, takes samples from probability distributions, calculates their likelihoods, and optimizes them.
Pixyz consists of a step-by-step framework with three APIs. As shown in Figure 1, the implementation flow is as follows: (1-1) define probability distributions by the neural networks (Distribution API) (1-2) design a probabilistic model by calculating the product of probability distributions (Distribution API), (2) design the objective function (Loss API), and (3) learn to optimize the defined objective function (Model API). The advantage of this step-bystep implementation by APIs is that they do not interfere with each other. For example, there is no need to change the objective function or model when changing the probability distribution and there is no need to change the network structure when changing the objective function since the operation is completed within Loss API.
Each API is described in turn below. Figure 3 shows a concrete implementation example of VAEs (Equation 6) that supplements the explanation of each API.

Distribution API
The first step in Pixyz is to define the probability distributions that make up the probabilistic model. Distribution API has two major features for implementing probabilistic models: 1. it can define probability distributions in the form of encapsulating DNNs and 2. it can implement joint distributions by the product of the distributions of each variable.

Defining probability distributions by the neural networks
Basic probability distributions such as Gaussian (Normal) and Bernoulli (Bernoulli) distributions are implemented under pixyz.distributions. The API for these distribution classes is almost identical to that of the PyTorch Distribution 1 , and the arguments of these classes include the parameters of their corresponding distributions. It is also possible to set the name of the random variable in var and the name of the probability distribution in name as their arguments. To design a conditional distribution, it can be initialized by specifying the name of the random variable to be conditioned as the initial value of cond var.
After creating an instance of the distribution class in this manner, methods such as sample and get log prob can be used to sample and evaluate the likelihood of a given sample, respectively. In Pixyz, all samples are represented in dictionary form (dict), where user-defined random variable names and their realizations are stored as keys and values, respectively.
Next, we explain how to define a probability distribution with a DNN in Pixyz. As shown in Equation (3), when defining the parameter λ of a distribution g as the output of a neural network f θ with z as input, we first inherit the class that corresponds to the distribution g, and then, as in the usual PyTorch implementation, we write the network f θ in its constructor and the computation flow from input z to the output (i.e., the parameter of the distribution λ) in its forward method. See Figure 3 for an example of how to define generative and inference models in VAEs using DNNs.
Equations (4) and (5) can also be implemented by Distribution API. When defining samples from a probability distribution as the output of a DNN f θ as in Equation (4), it is implemented in the same manner as Equation (3) except that the Deterministic class should be inherited as the distribution class. When defining the likelihood as a reversible variable transformation as in Equation (5), we use either the TransformedDistribution or InverseTransformedDistribution classes as the distribution class and set the base distribution and a flow network 2 as their arguments.
Although they are defined in different ways, the instances generated from each distribution class can also use sample and get log prob in the same manner. In other words, once an instance has been generated, we can perform the computation of the distribution without knowledge of what kind of network is being used or how it is defined, which is consistent with the first feature of DGMs.

Designing a probabilistic model by calculating the product of probability distributions of each variable
In addition, Distribution API has a feature that allows the intuitive multiplication of distributions. For example, if we define the probability distributions p(x|z) and p(z), the joint distribution is their product, p(x, z) = p(x|z)p(z), which also appears in Equation (7).
Pixyz allows us to define the joint distribution as a product of instances of distribution classes 3 . After performing the product calculation, a graphical model defining the dependencies between the variables is constructed inside the instance of the joint distribution. This graphical model is constructed using NetworkX [13], a library for designing and computing graph networks 4 . Since  this joint distribution instance is also a distribution class, sampling and likelihood estimation can be performed in exactly the same framework regardless of its distribution type. This idea of expressing joint distributions by the product of probability distributions is quite different from the conventional PPLs (i.e., describing generative processes in a sequential manner). Although the approach for describing generative processes is intuitive, it only represents the flow of samples, and therefore requires a different procedure when calculating the likelihood of joint or conditional distributions. Specifically, one must actually input the data, trace the flow of the graph, store the realizations for each random variable, calculate the likelihood of the corresponding probability distributions, and finally calculate their product. This is the reason Pyro requires auxiliary methods such as trace, condition, and block for likelihood calculation, as described in Section 3. Figure 4 shows how Pyro and Pixyz implement a joint distribution. We find that Pyro performs likelihood estimation in a special way that is different from the simple distribution, while Pixyz can be implemented in a manner consistent with a simple distribution.
On the other hand, Pixyz, which represents joint distributions by products of distribution instances, allows the structure of the graph to be defined before the data flow. Furthermore, since each element of the product is a distribution instance (DNNs are encapsulated within them and do not appear in the product here) and the result of the product is also a distribution instance, both the likelihood estimation and sampling from it can be easily performed without the need for additional methods.
This difference in the way Pixyz and conventional PPLs define joint distributions can be viewed as the difference between a define-and-run (delayed execution) scheme and a define-byrun (sequential execution) scheme 1 . Since graphical models are usually designed before data are given in probabilistic models, we believe that the new framework we have proposed is more feasible for implementing DGMs. Note that the samples inside each distribution are implemented by PyTorch with DNNs, so it is a define-by-run scheme. Therefore, Pixyz uses a scheme that random variables (usually multiple conditional variables to a single variable). Generating samples from joint distribution can be implemented with an ancestor sampling procedure that prepares the condition variables in order by topological sorting from the connection relations. This process outputs a dictionary with the random variable names as keys and the samples as values, aggregated along the directed edges of the graph. The log-likelihood of the joint distribution get log prob is computed by adding the log-likelihoods of each edge (distribution). 1 The terms define-and-run and define-by-run are used in the deep learning library Chainer [36]. both flexibly designs each probability distribution depending on the data and explicitly designs the probability model before the data are given.
One might be concerned that if distribution instances are abstracted in this manner, we might lose track of the distributions and networks that designed them. In Distribution API, we can use Python's print method to check the distribution instance information. In addition, the print latex method included in Pixyz can be used to display the equation of a distribution instance in LaTeX format ( Figure 5, left). If this distribution instance is joint distribution, the factorization of the distributions that compose it is displayed. Furthermore, as mentioned above, joint distribution is treated internally as a graph of NetworkX, so it can also be visualized as a graph ( Figure 5, right).

Loss API
Pixyz has a higher-level API called Loss API that calculates the objective function from given distributions. Loss API includes log-likelihood, entropy, expectation, divergence between distributions, adversarial learning loss, etc. in pixyz.losses. Each of these takes distribution instances as arguments at initialization and generates an instance of the objective (or loss) function.
A feature of Loss API is that it can perform arbitrary arithmetic operations between objective function instances, whereas Distribution API can multiply distributions. For example, the objective function of VAEs in Equation (6) is composed of two terms. Therefore, we can define this objective function by creating an objective function instance for each of them and summing them. In recent complex DGMs, the setting of the objective function itself plays an important role in the design of the model [10] and as a result, their objective functions are now composed of multiple terms. As mentioned above, the implementation of such models is difficult with conventional PPLs. On the other hand, with Loss API, Pixyz makes it possible to implement arbitrary DGMs by simply writing the equation for their objective function. For the implementation of VAE using the Loss API, please refer to the box named Loss API in Figure 3. In addition, as with Distribution API, the print and print latex methods allow us to check what equation we have defined for the objective function instance.
The value of the objective function instance can be evaluated by providing the data that corresponds to the observed variable; Loss API allows the evaluation of the instance by setting the data as the argument of the eval method. Thus, the framework of Loss API, in which an equation is first defined and then the values are evaluated, can be considered a define-and-run scheme (delayed execution), similar to the likelihood calculation and sampling in Distribution

API.
Another advantage of Loss API is that it separates the definition of the objective function from the learning algorithm. For example, in libraries such as Edward [37], the model (objective function) and the learning algorithm are integrated, thus making it difficult to extend to complex DGMs. Meanwhile, Loss API in Pixyz allows us to create arbitrary objective functions; for example, we can implement models that combine VAEs and adversarial learning (such as FactorVAE [16]).
Here we present implementations of complex DGMs using the Loss API. Figure 6(a) shows the equation for the M2 model [19], a semi-supervised learning model with VAEs, and its implementation using the Loss API. It can be seen that even for models with multiple terms, the objective function can be designed using Loss API as if we wrote the equation directly. As a more complex model, Figure 6(b) shows the equation and implementation of TD-VAE [10]. Although TD-VAE is one of the complex time-series DGMs, we can confirm that it can be implemented in a concise and readable manner. Note that the IterativeLoss class in Figure 6(b) is a Loss API class that iterates the loss of each step in the time direction, which allows for a concise implementation of time-series models. .,(/+' +,-" ! ! ! " # $%& ' " #(" ) * #$ +, % " # -' " ! Figure 7. Inference by the same DNN given the same input appearing twice in both terms of the objective function (ELBO) of VAEs (left). We propose a faster evaluation of the objective function by memoization, i.e., memoizing the input forward propagated parameters and using the memoized parameters the second or later times the same input is given (right).

Model API
Model API creates a model instance by initializing the model class (pixyz.models.Model) and passing it the objective function instance defined in Loss API, the distribution instance to be learned, and the optimization algorithm. By passing data to the train and test methods of this instance and executing them, we can train and test the model. In addition to pixyz.models.Model, which allows users to set arbitrary objective functions, there are model classes with internally defined objective functions for users who want to train basic DGMs such as VAEs and GANs (pixyz.models.VAE and pixyz.models.GAN).

Toward faster execution: memoizing inference results
When evaluating an objective function of DGMs, the same calculation might be performed multiple times in the equation. For example, in the objective function for VAEs in Equation (6), an inference model given the same input appears in each term (Figure 7, left). Therefore, if implemented in a straightforward manner, the forward propagation of DNNs, in which the parameters of the inference model are calculated internally, must be performed twice, which increases the computational cost. However, the values of the distribution parameters obtained from the same input should be the same as long as no probabilistic process (such as dropout) in the forward propagation of the DNN that defines this distribution 1 . Therefore, we propose speeding up the evaluation of the objective function by memoization. Specifically, the output (parameter values) of the DNNs corresponding to a given input is memoized, and if the input is the same at the next forward propagation, the memoized value is output, and if it is different, the output result of another forward propagation overwrites the memoized value (Figure 7, right). To implement this memoization method, we used lru cache, which executes the Least Recently Used (LRU) cache provided by PyTorch and Python 2 . Memoization is built into Distribution API and is performed automatically (whether to perform memoization can be set by changing the size of the cache).

Experiments
Here we compare the runtime of Pixyz with those of PyTorch and another PPL, Pyro. We used a VAE and a deep Markov model (DMM) [20] as the models to be trained. The architecture of each model conforms to the Pyro sample code 3 , and the PyTorch and Pixyz implementations are aligned to the same architecture, with a batch size of 128. In this experiment, we used a computer with an Intel R ○ Xeon R ○ Gold 5218R CPU @ 2.10GHz ×2 and NVIDIA TITAN RTX as  (6)) and by Monte Carlo approximation (MC; Equation (7)) and both with and without LRU cache. the experimental environment. We used the MNIST dataset [22] for the VAE and the polyphonic music dataset [2] for the DMM. Table 1 shows the VAE learning execution time for one step update. As in the experiments in [1], the results are shown as averages over 10 epochs, varying the hidden layer dimension #h and the latent variable dimension #z 1 .
The results show that Pyro and Pixyz are both slower than PyTorch but that Pixyz is faster than Pyro. Note that the PyTorch implementation computes the regularization term of the VAE analytically (corresponding to Equation (6)) while Pyro is pre-designed to compute it using a Monte Carlo approximation (Equation (7)). On the other hand, Pixyz can easily implement either objective function thanks to Loss API, so we have included results for both cases. Although the result of the Monte Carlo approximation in Pixyz is slower than the analytical one, it is still faster than Pyro. This might be due to the simpler internal operations and manipulations in Pixyz than in Pyro 2 . Furthermore, Bingham et. al. [1] argued that the gap between Pyro and PyTorch reduces as the number of hidden layers increases, which is also true for Pixyz. Furthermore, the speed is further improved by memoization with LRU cache. Finally, the analytic calculation and memoization showed a 20 − 26% improvement compared to Pyro.
Next, we compared the runtimes for a DMM, which is a time-series DGMs that can be considered a temporal expansion of VAEs. Table 2 shows that the trend of the difference between Pixyz and Pyro in DMM is almost the same as that in VAE. This means that the learning speed advantage of Pixyz is also valid in the time-series models.

Summary and future work
In this paper, we proposed Pixyz as a library for implementing DGMs. Pixyz utilizes three APIs to deal with the features of recent DGMs: (1) DNNs are encapsulated by probability distributions, and (2) models are designed and learned based on the objective function. We have shown that these APIs can be used to implement DGMs concisely, and that they are also suitable for designing DGMs in terms of execution time. In addition to the results presented in this paper, we have confirmed that DGMs learning complex environments, e.g., generative query networks [29], semi-supervised learning models using DGMs, e.g., M2 model [19], other complex sequential DGMs, e.g., variational recurrent neural networks [5] and TD-VAE [10], and modelbased reinforcement learning (i.e., world models), e.g., Dreamer [11], can also be implemented and trained on Pixyz 3 .
However, some DGMs remain that Pixyz does not yet support, such as energy-based models [8], auto-regressive models [25,39], score matching [34], and diffusion models [15]. Furthermore, although Pixyz is a library specialized for DGMs, it is inadequate when viewed as PPLs. For example, in sampling, only ancestral sampling from probabilistic models is supported, and Bayesian inference on parameter distributions, which is often used in Bayesian neural networks, is not supported. In the future, we plan to address those aspects that Pixyz does not currently support.
DGMs and world models are more difficult to use than ordinary DNNs because of the difficulties in understanding and implementing them; we hope that this library can play a role in eliminating such barriers.