Closed nihargupte-ph closed 5 months ago
This seems to happen because the
glasflow.nflows.transforms.coupling.PiecewiseRationalQuadraticCouplingTransform
doesn't like tensors of the shape [n_batch, 1]
I've tracked it down to the following line: https://github.com/uofgravity/nflows/blob/glasflow/nflows/transforms/coupling.py#L84
When training running this transform on a [n_batch, 1] shape tensor this identity_split
is a size [n_batch, 0] tensor. Whereas if we have a 2D flow identity_split is a [n_batch, 1] size tensor.
But actually, this is a conceptual problem now that I think about it. In a coupling transform one needs at least a dimension 2 vector so that one can swap the identity portion (0th column) and the transform portion (1st column) of the vector after the transform.
A lazy workaround could be to pass a vector of 0's to the NDE as a second dummy column. I'm not sure how well this would do performance-wise since we would effectively be learning a delta-function cross the GNPE proxy distribution. (And learning a delta function for a flow is always hard). But I don't have a good intuition on this.
Otherwise, we could use a simpler set of transforms for the 1D case. That is something that doesn't use a coupling transform.
@stephengreen @jonaswildberger thoughts?
When doing inference with a 1 detector network, one needs to train an unconditional density estimator on the set of 1D GNPE samples. However, for some reason nflows does not like this as it thinks the training vector is the wrong shape. This occurs during the sampling step of dingo_pipe. The error message is the following: