2020年12月23日星期三

Conditional MaskedAutoregressive Flow in tensorflow outputs NAN

I am experimenting with a tensorflow bijector (MaskedAutoregressive Flow). Essentially I want it to be a mapping from a length 20 vector drawn from some base distribution to some other distribution, conditioned on some input value (which is a length 10 vector). Below is my code.

tfd = tfp.distributions  tfb = tfp.bijectors    input = np.ones(shape=(20)).astype(np.float32)  condition = np.random.normal(size=(10)).astype(np.float32) + 10    fn = tfb.AutoregressiveNetwork(params=2, event_shape=20, conditional=True, conditional_event_shape=10, hidden_units=[10, 10])  bijector = tfb.MaskedAutoregressiveFlow(fn)    print(bijector.forward(input, conditional_input=condition))

Result of running the code gives me:

tf.Tensor(  [nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan   nan nan], shape=(20,), dtype=float32)

I don't think my input or condition vectors are big enough to cause exploding values. Any ideas on what I might be doing wrong? Thanks!

For reference, I am using tensorflow-probability = 0.11.0

https://stackoverflow.com/questions/65433467/conditional-maskedautoregressive-flow-in-tensorflow-outputs-nan December 24, 2020 at 11:04AM

没有评论:

发表评论