tensorflow / tensorflow/probability

Error initializing tfb.AutoregressiveNetwork using jax substrate

Open
#1,699 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
4.4k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

Trying to initialize an instance of tfb.AutoregressiveNetwork using the jax substrate fails with an AttributeError.

With the example usage from the docs:

from tensorflow_probability.substrates import jax as tfp
tfb = tfp.bijector

tfb.AutoregressiveNetwork(params=2, hidden_units=[10,10])

raises the error:

File .../site-packages/tensorflow_probability/substrates/jax/bijectors/masked_autoregressive.py:967, in AutoregressiveNetwork.__init__(self, params, event_shape, conditional, conditional_event_shape, conditional_input_layers, hidden_units, input_order, hidden_degrees, activation, use_bias, kernel_initializer, bias_initializer, kernel_regularizer, bias_regularizer, kernel_constraint, bias_constraint, validate_args, **kwargs)
    965 self._kernel_regularizer = kernel_regularizer
    966 self._bias_regularizer = bias_regularizer
--> 967 self._kernel_constraint = tf.keras.constraints.get(kernel_constraint)
    968 self._bias_constraint = bias_constraint
    969 self._validate_args = validate_args

AttributeError: module 'tensorflow_probability.python.internal.backend.jax.numpy_keras' has no attribute 'constraints'

Tested with:
tfp version: 0.19.0
jax version: 0.4.4 and 0.3.25

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tensorflow_probability/substrates/jax/bijectors/masked_autoregressive.py around the AutoregressiveNetwork initializer and reproduce the documented example. Check how the JAX backend handles kernel constraints; done means the example initializes without the reported AttributeError and has a regression test for the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.