Skip to content

Commit

Permalink
[1/3] Reverb: Rename distributions package to item_selectors.
Browse files Browse the repository at this point in the history
This rename reflects the fact that not all of the "distributions" were stochastic.

PiperOrigin-RevId: 312486733
Change-Id: Iaac336a8eee1ea9bbbf3ad7ee7a88290ebc46471
  • Loading branch information
fastturtle authored and copybara-github committed May 20, 2020
1 parent c5da5cd commit 602dea6
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 16 deletions.
23 changes: 16 additions & 7 deletions reverb/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ reverb_pytype_strict_library(
":distributions",
":ensure_tf_install",
":errors",
":item_selectors",
":rate_limiters",
":replay_sample",
":server",
Expand All @@ -36,7 +37,7 @@ reverb_pytype_strict_library(
name = "distributions",
srcs = ["distributions.py"],
srcs_version = "PY3",
deps = [":pybind"],
deps = [":item_selectors"],
)

reverb_pytype_strict_library(
Expand Down Expand Up @@ -147,6 +148,20 @@ reverb_pytype_library(
],
)

reverb_pytype_strict_library(
name = "ensure_tf_install",
srcs = ["platform/default/ensure_tf_install.py"],
srcs_version = "PY3",
)

reverb_pytype_strict_library(
name = "item_selectors",
srcs = ["item_selectors.py"],
srcs_version = "PY3",
visibility = ["//visibility:private"],
deps = [":pybind"],
)

reverb_py_test(
name = "checkpointer_test",
srcs = ["checkpointer_test.py"],
Expand Down Expand Up @@ -215,9 +230,3 @@ reverb_py_test(
":reverb",
],
)

reverb_pytype_strict_library(
name = "ensure_tf_install",
srcs = ["platform/default/ensure_tf_install.py"],
srcs_version = "PY3",
)
1 change: 1 addition & 0 deletions reverb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# pylint: enable=g-bad-import-order

from reverb import distributions
from reverb import item_selectors as selectors
from reverb import rate_limiters

from reverb.client import Client
Expand Down
16 changes: 7 additions & 9 deletions reverb/distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@

"""Sampling and removing distributions."""

import functools
from reverb import item_selectors

from reverb import pybind

Fifo = pybind.FifoDistribution
Lifo = pybind.LifoDistribution
MaxHeap = functools.partial(pybind.HeapDistribution, False) # pylint: disable=invalid-name
MinHeap = functools.partial(pybind.HeapDistribution, True) # pylint: disable=invalid-name
Prioritized = pybind.PrioritizedDistribution
Uniform = pybind.UniformDistribution
Fifo = item_selectors.Fifo
Lifo = item_selectors.Lifo
MaxHeap = item_selectors.MaxHeap
MinHeap = item_selectors.MinHeap
Prioritized = item_selectors.Prioritized
Uniform = item_selectors.Uniform
26 changes: 26 additions & 0 deletions reverb/item_selectors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2019 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Sampling and removing distributions."""

import functools

from reverb import pybind

Fifo = pybind.FifoDistribution
Lifo = pybind.LifoDistribution
MaxHeap = functools.partial(pybind.HeapDistribution, False) # pylint: disable=invalid-name
MinHeap = functools.partial(pybind.HeapDistribution, True) # pylint: disable=invalid-name
Prioritized = pybind.PrioritizedDistribution
Uniform = pybind.UniformDistribution

0 comments on commit 602dea6

Please sign in to comment.