Skip to content

Commit 7bee0d0

Browse files
SiegeLordExjburnim
authored andcommitted
Add experimental joint-distribution layers library.
PiperOrigin-RevId: 396021661
1 parent 26919df commit 7bee0d0

File tree

7 files changed

+752
-1
lines changed

7 files changed

+752
-1
lines changed

tensorflow_probability/python/build_defs.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ NO_REWRITE_NEEDED = [
1818
"internal:all_util",
1919
"internal:docstring_util",
2020
"internal:reparameterization",
21-
"layers",
21+
"python/layers",
2222
"platform_google",
2323
]
2424

tensorflow_probability/python/experimental/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ multi_substrate_py_library(
5353
"//tensorflow_probability/python/experimental/bijectors",
5454
"//tensorflow_probability/python/experimental/distribute",
5555
"//tensorflow_probability/python/experimental/distributions",
56+
"//tensorflow_probability/python/experimental/joint_distribution_layers",
5657
"//tensorflow_probability/python/experimental/linalg",
5758
"//tensorflow_probability/python/experimental/marginalize",
5859
"//tensorflow_probability/python/experimental/math",

tensorflow_probability/python/experimental/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
from tensorflow_probability.python.experimental import bijectors
3636
from tensorflow_probability.python.experimental import distribute
3737
from tensorflow_probability.python.experimental import distributions
38+
from tensorflow_probability.python.experimental import joint_distribution_layers
3839
from tensorflow_probability.python.experimental import linalg
3940
from tensorflow_probability.python.experimental import marginalize
4041
from tensorflow_probability.python.experimental import math
@@ -62,6 +63,7 @@
6263
'bijectors',
6364
'distribute',
6465
'distributions',
66+
'joint_distribution_layers',
6567
'linalg',
6668
'marginalize',
6769
'math',
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Copyright 2021 The TensorFlow Probability Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ============================================================================
15+
# Description:
16+
# Joint Distribution Layers library.
17+
18+
load(
19+
"//tensorflow_probability/python:build_defs.bzl",
20+
"multi_substrate_py_library",
21+
"multi_substrate_py_test",
22+
)
23+
24+
package(
25+
default_visibility = [
26+
"//tensorflow_probability:__subpackages__",
27+
],
28+
)
29+
30+
licenses(["notice"])
31+
32+
multi_substrate_py_library(
33+
name = "joint_distribution_layers",
34+
srcs = ["__init__.py"],
35+
srcs_version = "PY3",
36+
deps = [
37+
":layers",
38+
],
39+
)
40+
41+
multi_substrate_py_library(
42+
name = "layers",
43+
srcs = ["layers.py"],
44+
srcs_version = "PY3",
45+
deps = [
46+
# numpy dep,
47+
# tensorflow dep,
48+
"//tensorflow_probability/python/distributions:deterministic",
49+
"//tensorflow_probability/python/distributions:joint_distribution_coroutine",
50+
"//tensorflow_probability/python/distributions:normal",
51+
"//tensorflow_probability/python/distributions:sample",
52+
"//tensorflow_probability/python/internal:vectorization_util",
53+
],
54+
)
55+
56+
multi_substrate_py_test(
57+
name = "layers_test",
58+
size = "medium",
59+
srcs = ["layers_test.py"],
60+
srcs_version = "PY3",
61+
deps = [
62+
# absl/testing:parameterized dep,
63+
# tensorflow dep,
64+
"//tensorflow_probability",
65+
"//tensorflow_probability/python/internal:custom_gradient",
66+
"//tensorflow_probability/python/internal:prefer_static",
67+
"//tensorflow_probability/python/internal:test_util",
68+
],
69+
)
70+
71+
exports_files(
72+
glob(["**/*.py"]),
73+
visibility = ["//tensorflow_probability:__subpackages__"],
74+
)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2021 The TensorFlow Probability Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ============================================================================
15+
"""Experimental Joint Distribution Layers library."""
16+
17+
from tensorflow_probability.python.experimental.joint_distribution_layers import layers
18+
from tensorflow_probability.python.experimental.joint_distribution_layers.layers import *
19+
20+
__all__ = layers.__all__

0 commit comments

Comments
 (0)