From 7485da3929ab07a6e74e62feb2b1215f3b7b2193 Mon Sep 17 00:00:00 2001 From: Michal Klein Date: Wed, 3 Aug 2022 11:38:31 +0200 Subject: [PATCH] Fix unused variables in tests, lexer and badge --- README.md | 2 +- docs/_static/images/colab-badge.svg | 1 + docs/_static/{ => images}/logoOTT.ico | Bin docs/_static/{ => images}/logoOTT.png | Bin docs/conf.py | 6 ++--- docs/notebooks/One_Sinkhorn.ipynb | 15 ++++++++--- docs/notebooks/fairness.ipynb | 13 +++++++-- docs/notebooks/gromov_wasserstein.ipynb | 33 ++++++++++------------- docs/notebooks/soft_sort.ipynb | 15 ++++++++--- tests/core/continuous_barycenter_test.py | 8 +++--- tests/tools/sinkhorn_divergence_test.py | 2 +- 11 files changed, 60 insertions(+), 35 deletions(-) create mode 100644 docs/_static/images/colab-badge.svg rename docs/_static/{ => images}/logoOTT.ico (100%) rename docs/_static/{ => images}/logoOTT.png (100%) diff --git a/README.md b/README.md index 33879de0f..0bf00c575 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -logo +logo # Optimal Transport Tools (OTT). diff --git a/docs/_static/images/colab-badge.svg b/docs/_static/images/colab-badge.svg new file mode 100644 index 000000000..e5830d533 --- /dev/null +++ b/docs/_static/images/colab-badge.svg @@ -0,0 +1 @@ + Open in ColabOpen in Colab diff --git a/docs/_static/logoOTT.ico b/docs/_static/images/logoOTT.ico similarity index 100% rename from docs/_static/logoOTT.ico rename to docs/_static/images/logoOTT.ico diff --git a/docs/_static/logoOTT.png b/docs/_static/images/logoOTT.png similarity index 100% rename from docs/_static/logoOTT.png rename to docs/_static/images/logoOTT.png diff --git a/docs/conf.py b/docs/conf.py index e618859bb..b66c25fcd 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -93,8 +93,8 @@ # a list of builtin themes. html_theme = 'sphinx_book_theme' -html_logo = '_static/logoOTT.png' -html_favicon = '_static/logoOTT.ico' +html_logo = '_static/images/logoOTT.png' +html_favicon = '_static/images/logoOTT.ico' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, @@ -110,7 +110,7 @@
- Colab badge + Open in Colab
""" diff --git a/docs/notebooks/One_Sinkhorn.ipynb b/docs/notebooks/One_Sinkhorn.ipynb index ec8159d37..3735ccf20 100644 --- a/docs/notebooks/One_Sinkhorn.ipynb +++ b/docs/notebooks/One_Sinkhorn.ipynb @@ -20,7 +20,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -32,7 +32,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": { "id": "CRSA3KsJtlpF" }, @@ -1134,7 +1134,16 @@ "name": "python3" }, "language_info": { - "name": "python" + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.12" } }, "nbformat": 4, diff --git a/docs/notebooks/fairness.ipynb b/docs/notebooks/fairness.ipynb index 6e9f15a14..33f4da429 100644 --- a/docs/notebooks/fairness.ipynb +++ b/docs/notebooks/fairness.ipynb @@ -32,7 +32,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -592,7 +592,16 @@ "name": "python3" }, "language_info": { - "name": "python" + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.7" } }, "nbformat": 4, diff --git a/docs/notebooks/gromov_wasserstein.ipynb b/docs/notebooks/gromov_wasserstein.ipynb index 5243effd5..2ae99a5ea 100644 --- a/docs/notebooks/gromov_wasserstein.ipynb +++ b/docs/notebooks/gromov_wasserstein.ipynb @@ -22,22 +22,8 @@ { "cell_type": "code", "execution_count": 1, - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "yoauHUVPTyAl", - "outputId": "d8bc8507-972f-4ac9-e997-e733edc218be" - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Requirement already satisfied: ott-jax in /usr/local/lib/python3.7/dist-packages (0.2.2)\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import sys\n", "\n", @@ -9154,12 +9140,21 @@ "provenance": [] }, "kernelspec": { - "display_name": "Python 3", + "display_name": "ott", "language": "python", - "name": "python3" + "name": "ott" }, "language_info": { - "name": "python" + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.12" } }, "nbformat": 4, diff --git a/docs/notebooks/soft_sort.ipynb b/docs/notebooks/soft_sort.ipynb index 739dbba72..69a801f3d 100644 --- a/docs/notebooks/soft_sort.ipynb +++ b/docs/notebooks/soft_sort.ipynb @@ -11,7 +11,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -23,7 +23,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": { "id": "CRSA3KsJtlpF" }, @@ -765,7 +765,16 @@ "name": "python3" }, "language_info": { - "name": "python" + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.12" } }, "nbformat": 4, diff --git a/tests/core/continuous_barycenter_test.py b/tests/core/continuous_barycenter_test.py index 5f7312922..5c862a47f 100644 --- a/tests/core/continuous_barycenter_test.py +++ b/tests/core/continuous_barycenter_test.py @@ -201,7 +201,7 @@ def test_bures_barycenter( b1 = b2 = jnp.ones(num_components) / num_components y = jnp.concatenate((y1, y2)) - jnp.concatenate((b1, b2)) + b = jnp.concatenate((b1, b2)) gmm_generator = gaussian_mixture.GaussianMixture.from_random( rng, n_components=bar_size, n_dimensions=dimension @@ -213,7 +213,8 @@ def test_bures_barycenter( x_init = means_and_covs_to_x(x_init_means, x_init_covs, dimension) seg_y, seg_b = segment.segment_point_cloud( - y, + x=y, + a=b, num_segments=num_measures, max_measure_size=num_components, num_per_segment=(num_components, num_components), @@ -279,6 +280,7 @@ def test_bures_barycenter_different_number_of_components( n_components = jnp.array([3, 4]) # the number of components of the GMMs num_measures = n_components.size bar_size = 5 # the size of the barycenter + max_measure_size = int(jnp.max(n_components)) # Create an instance of the Bures cost class. b_cost = costs.Bures(dimension=dim) @@ -345,7 +347,7 @@ def test_bures_barycenter_different_number_of_components( cost_fn=b_cost, epsilon=epsilon, num_segments=num_measures, - max_measure_size=4, + max_measure_size=max_measure_size, segment_ids=seg_ids, ) assert bar_p.max_measure_size == 4 diff --git a/tests/tools/sinkhorn_divergence_test.py b/tests/tools/sinkhorn_divergence_test.py index f5b0a80ac..6995103cd 100644 --- a/tests/tools/sinkhorn_divergence_test.py +++ b/tests/tools/sinkhorn_divergence_test.py @@ -261,7 +261,7 @@ def test_segment_sinkhorn_different_segment_sizes(self): segmented_divergences = sink_div( jnp.concatenate((x1, x2)), jnp.concatenate((y1, y2)), - # these 2 arguments are not necessary for jitting + # these 2 arguments are not necessary for jitting: # num_segments=2, # max_measure_size=15, num_per_segment_x=(10, 12),