Skip to content

Commit fc1d585

Browse files
Remove tfp.experimental.substrates. Users should use
tfp.substrates.{jax,numpy} instead. PiperOrigin-RevId: 628430022
1 parent ded7219 commit fc1d585

File tree

11 files changed

+11
-81
lines changed

11 files changed

+11
-81
lines changed

BUILD

+1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ sh_binary(
2020
"required_packages.py",
2121
"setup.py",
2222
"//tensorflow_probability",
23+
"//tensorflow_probability/substrates",
2324
],
2425
)

conftest.py

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
collect_ignore = [
2121
"discussion/",
2222
"setup.py",
23-
"tensorflow_probability/python/experimental/substrates/"
2423
]
2524

2625

tensorflow_probability/python/BUILD

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ py_library(
4141
"//tensorflow_probability/python/glm",
4242
"//tensorflow_probability/python/internal",
4343
"//tensorflow_probability/python/internal:all_util",
44+
"//tensorflow_probability/python/internal:lazy_loader",
4445
"//tensorflow_probability/python/layers",
4546
"//tensorflow_probability/python/math",
4647
"//tensorflow_probability/python/mcmc",

tensorflow_probability/python/experimental/BUILD

-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ multi_substrate_py_library(
4141
"//tensorflow_probability/python/experimental/auto_batching",
4242
"//tensorflow_probability/python/experimental/marginalize",
4343
"//tensorflow_probability/python/experimental/nn",
44-
"//tensorflow_probability/python/experimental/substrates",
4544
"//tensorflow_probability/python/experimental/timeseries",
4645
"//tensorflow_probability/python/internal:auto_composite_tensor",
4746
"//tensorflow_probability/python/experimental/util:composite_tensor",
@@ -64,7 +63,6 @@ multi_substrate_py_library(
6463
"//tensorflow_probability/python/experimental/sequential",
6564
"//tensorflow_probability/python/experimental/stats",
6665
"//tensorflow_probability/python/experimental/sts_gibbs",
67-
"//tensorflow_probability/python/experimental/substrates",
6866
"//tensorflow_probability/python/experimental/tangent_spaces",
6967
"//tensorflow_probability/python/experimental/timeseries",
7068
"//tensorflow_probability/python/experimental/util",

tensorflow_probability/python/experimental/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
from tensorflow_probability.python.experimental import sequential
4444
from tensorflow_probability.python.experimental import stats
4545
from tensorflow_probability.python.experimental import sts_gibbs
46-
from tensorflow_probability.python.experimental import substrates
4746
from tensorflow_probability.python.experimental import tangent_spaces
4847
from tensorflow_probability.python.experimental import timeseries
4948
from tensorflow_probability.python.experimental import util
@@ -76,7 +75,6 @@
7675
'sequential',
7776
'sts_gibbs',
7877
'stats',
79-
'substrates',
8078
'tangent_spaces',
8179
'timeseries',
8280
'unnest',

tensorflow_probability/python/experimental/substrates/BUILD

-37
This file was deleted.

tensorflow_probability/python/experimental/substrates/__init__.py

-33
This file was deleted.

tensorflow_probability/python/internal/lazy_loader.py

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
import types
2020

2121

22+
__all__ = ['LazyLoader']
23+
24+
2225
class LazyLoader(types.ModuleType):
2326
"""Lazily import a module to avoid pulling in large deps, defer checks."""
2427

tensorflow_probability/substrates/BUILD

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ py_library(
3232
srcs = [
3333
"__init__.py",
3434
],
35+
# :substrates needs to be visible to the external :pip_pkg target.
36+
visibility = ["//visibility:public"], # EnableOnExport
3537
deps = [
3638
":jax",
3739
":numpy",

tensorflow_probability/substrates/meta/rewrite.py

+3
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,9 @@ def disable_all(name):
258258
if FLAGS.numpy_to_jax:
259259
contents = contents.replace('tfp.substrates.numpy', 'tfp.substrates.jax')
260260
contents = contents.replace('substrates.numpy', 'substrates.jax')
261+
contents = contents.replace(
262+
'tensorflow_probability.substrates import numpy',
263+
'tensorflow_probability.substrates import jax')
261264
contents = contents.replace('backend.numpy', 'backend.jax')
262265
contents = contents.replace('backend import numpy as tf',
263266
'backend import jax as tf')

tensorflow_probability/tools/build_docs.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,7 @@
4646

4747
FLAGS = flags.FLAGS
4848

49-
DO_NOT_GENERATE_DOCS_FOR = [
50-
tfp.experimental.substrates.jax.tf2jax,
51-
tfp.experimental.substrates.jax.experimental,
52-
tfp.experimental.substrates.numpy.tf2numpy,
53-
tfp.experimental.substrates.numpy.experimental,
54-
]
49+
DO_NOT_GENERATE_DOCS_FOR = []
5550

5651

5752
def internal_filter(path, parent, children):

0 commit comments

Comments
 (0)