Skip to content

Commit

Permalink
Remove tfp.experimental.substrates. Users should use
Browse files Browse the repository at this point in the history
tfp.substrates.{jax,numpy} instead.

PiperOrigin-RevId: 623901959
  • Loading branch information
ThomasColthurst authored and tensorflower-gardener committed Apr 11, 2024
1 parent c6b3eb7 commit 5e9058a
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 81 deletions.
1 change: 1 addition & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ sh_binary(
"required_packages.py",
"setup.py",
"//tensorflow_probability",
"//tensorflow_probability/substrates",
],
)
1 change: 0 additions & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
collect_ignore = [
"discussion/",
"setup.py",
"tensorflow_probability/python/experimental/substrates/"
]


Expand Down
1 change: 1 addition & 0 deletions tensorflow_probability/python/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ py_library(
"//tensorflow_probability/python/glm",
"//tensorflow_probability/python/internal",
"//tensorflow_probability/python/internal:all_util",
"//tensorflow_probability/python/internal:lazy_loader",
"//tensorflow_probability/python/layers",
"//tensorflow_probability/python/math",
"//tensorflow_probability/python/mcmc",
Expand Down
2 changes: 0 additions & 2 deletions tensorflow_probability/python/experimental/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ multi_substrate_py_library(
"//tensorflow_probability/python/experimental/auto_batching",
"//tensorflow_probability/python/experimental/marginalize",
"//tensorflow_probability/python/experimental/nn",
"//tensorflow_probability/python/experimental/substrates",
"//tensorflow_probability/python/experimental/timeseries",
"//tensorflow_probability/python/internal:auto_composite_tensor",
"//tensorflow_probability/python/experimental/util:composite_tensor",
Expand All @@ -64,7 +63,6 @@ multi_substrate_py_library(
"//tensorflow_probability/python/experimental/sequential",
"//tensorflow_probability/python/experimental/stats",
"//tensorflow_probability/python/experimental/sts_gibbs",
"//tensorflow_probability/python/experimental/substrates",
"//tensorflow_probability/python/experimental/tangent_spaces",
"//tensorflow_probability/python/experimental/timeseries",
"//tensorflow_probability/python/experimental/util",
Expand Down
2 changes: 0 additions & 2 deletions tensorflow_probability/python/experimental/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
from tensorflow_probability.python.experimental import sequential
from tensorflow_probability.python.experimental import stats
from tensorflow_probability.python.experimental import sts_gibbs
from tensorflow_probability.python.experimental import substrates
from tensorflow_probability.python.experimental import tangent_spaces
from tensorflow_probability.python.experimental import timeseries
from tensorflow_probability.python.experimental import util
Expand Down Expand Up @@ -76,7 +75,6 @@
'sequential',
'sts_gibbs',
'stats',
'substrates',
'tangent_spaces',
'timeseries',
'unnest',
Expand Down
37 changes: 0 additions & 37 deletions tensorflow_probability/python/experimental/substrates/BUILD

This file was deleted.

33 changes: 0 additions & 33 deletions tensorflow_probability/python/experimental/substrates/__init__.py

This file was deleted.

3 changes: 3 additions & 0 deletions tensorflow_probability/python/internal/lazy_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import types


__all__ = ['LazyLoader']


class LazyLoader(types.ModuleType):
"""Lazily import a module to avoid pulling in large deps, defer checks."""

Expand Down
2 changes: 2 additions & 0 deletions tensorflow_probability/substrates/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ py_library(
srcs = [
"__init__.py",
],
# :substrates needs to be visible to the external :pip_pkg target.
visibility = ["//visibility:public"], # EnableOnExport
deps = [
":jax",
":numpy",
Expand Down
3 changes: 3 additions & 0 deletions tensorflow_probability/substrates/meta/rewrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@ def disable_all(name):
if FLAGS.numpy_to_jax:
contents = contents.replace('tfp.substrates.numpy', 'tfp.substrates.jax')
contents = contents.replace('substrates.numpy', 'substrates.jax')
contents = contents.replace(
'tensorflow_probability.substrates import numpy',
'tensorflow_probability.substrates import jax')
contents = contents.replace('backend.numpy', 'backend.jax')
contents = contents.replace('backend import numpy as tf',
'backend import jax as tf')
Expand Down
7 changes: 1 addition & 6 deletions tensorflow_probability/tools/build_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,7 @@

FLAGS = flags.FLAGS

DO_NOT_GENERATE_DOCS_FOR = [
tfp.experimental.substrates.jax.tf2jax,
tfp.experimental.substrates.jax.experimental,
tfp.experimental.substrates.numpy.tf2numpy,
tfp.experimental.substrates.numpy.experimental,
]
DO_NOT_GENERATE_DOCS_FOR = []


def internal_filter(path, parent, children):
Expand Down

0 comments on commit 5e9058a

Please sign in to comment.