repo/gentoo:master commit in: sci-ml/torchvision/

"Alfredo Tupone" <[email protected]> Wed, 05 Aug 2026 15:27:33 +0000 (UTC)
Newsgroups gmane.linux.gentoo.cvs
Message-ID <1785943634.ca619cbb2b3e63b71854e146aea0fd4940a6f0b4.tupone@gentoo>
commit:     ca619cbb2b3e63b71854e146aea0fd4940a6f0b4
Author:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
AuthorDate: Wed Aug  5 15:26:00 2026 +0000
Commit:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Wed Aug  5 15:27:14 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ca619cbb

sci-ml/torchvision: add 0.28.0

Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>

 sci-ml/torchvision/Manifest                  |   1 +
 sci-ml/torchvision/torchvision-0.28.0.ebuild | 103 +++++++++++++++++++++++++++
 2 files changed, 104 insertions(+)

diff --git a/sci-ml/torchvision/Manifest b/sci-ml/torchvision/Manifest
index 8f991e6b1409..6f18f2176916 100644
--- a/sci-ml/torchvision/Manifest
+++ b/sci-ml/torchvision/Manifest
@@ -1,2 +1,3 @@
 DIST torchvision-0.26.0.tar.gz 14529912 BLAKE2B 27c38e5876ec8ef1b80abbb9b650761cb91924b7cbdd4007f5a801851f7030c35d594351eefa17a3757b846781601d7135986ed394af25c6cdf7a9f81f8b5809 SHA512 9f42f134f804c3ae60ce5237d775179f844874ccde9ee9ca3fbc191cdc11e3f71dc98f49e124ea385553fd8216ac76b8d741c7c033d8ca34fd8a09c8fa175cd1
 DIST torchvision-0.27.0.tar.gz 14456122 BLAKE2B 43723b07e8e5e2ccaad8306e5787e921a1e859c2dc60607dfc02d545c1d1a85d45852ca8a255aad92a542a58abb52109df621d77be81c21b3ffa0254f3df827b SHA512 805d1e013b01450578ca662223b87cbb2e642d270720a69b77b548dd89cfa294515c0842a0c33011fcfffebd9c1f3c1b0863d9e1bcf60ec42434371167a6fa5a
+DIST torchvision-0.28.0.tar.gz 14436315 BLAKE2B ce95297d9134d8926f28d3fc6bc7bf4abeb80f718896719ca67687ce73a5047a28ca7471217e332ac43e7fea0e28db92f80bf196489e99b3c56ca19baced7b6d SHA512 4b44c92bb5a6bc8e97a6107b428906a052235454e867c3b16da4e4e73c9ad9bf54e89ee5003685c6aef284ec26b1b02f653ce2f18fb88f332cd7cec3746a9a86

diff --git a/sci-ml/torchvision/torchvision-0.28.0.ebuild b/sci-ml/torchvision/torchvision-0.28.0.ebuild
new file mode 100644
index 000000000000..98c54a132bae
--- /dev/null
+++ b/sci-ml/torchvision/torchvision-0.28.0.ebuild
@@ -0,0 +1,103 @@
+# Copyright 2024-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..14} )
+DISTUTILS_SINGLE_IMPL=1
+DISTUTILS_USE_PEP517=setuptools
+DISTUTILS_EXT=1
+ROCM_SKIP_GLOBALS=1
+inherit cuda distutils-r1 multiprocessing rocm
+
+DESCRIPTION="Datasets, transforms and models to specific to computer vision"
+HOMEPAGE="https://github.com/pytorch/vision"
+SRC_URI="https://github.com/pytorch/vision/archive/refs/tags/v${PV}.tar.gz
+	-> ${P}.tar.gz"
+
+S="${WORKDIR}"/vision-${PV}
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="cuda +ffmpeg +jpeg +png rocm +webp"
+
+REQUIRED_USE="
+	?? ( cuda rocm )
+"
+
+RDEPEND="
+	$(python_gen_cond_dep '
+		dev-python/numpy[${PYTHON_USEDEP}]
+		dev-python/pillow[${PYTHON_USEDEP}]
+	')
+	jpeg? ( media-libs/libjpeg-turbo:= )
+	png? ( media-libs/libpng:= )
+	webp? ( media-libs/libwebp )
+	ffmpeg? ( media-video/ffmpeg )
+	=sci-ml/pytorch-2.13*[${PYTHON_SINGLE_USEDEP},numpy,cuda?,rocm?]
+"
+
+BDEPEND="
+	test? (
+		$(python_gen_cond_dep '
+			dev-python/lmdb[${PYTHON_USEDEP}]
+			dev-python/sympy[${PYTHON_USEDEP}]
+		')
+	)
+"
+
+EPYTEST_PLUGINS=( pytest-mock )
+
+distutils_enable_tests pytest
+
+src_prepare() {
+	use cuda && cuda_src_prepare
+	distutils-r1_src_prepare
+}
+
+src_configure() {
+	rocm_add_sandbox -w
+	distutils-r1_src_configure
+}
+
+python_compile() {
+	addpredict /dev/kfd
+	# bug #968112
+	addpredict /dev/random
+
+	export FORCE_CUDA=0
+	if use cuda || use rocm ; then
+	  export FORCE_CUDA=1
+	fi
+
+	export TORCHVISION_USE_PNG=$(usex png 1 0)
+	export TORCHVISION_USE_JPEG=$(usex jpeg 1 0)
+	export TORCHVISION_USE_WEBP=$(usex webp 1 0)
+	export TORCHVISION_USE_FFMPEG=$(usex ffmpeg 1 0)
+
+	export TORCHVISION_USE_NVJPEG=$(usex cuda 1 0)
+	export TORCHVISION_USE_VIDEO_CODEC=$(usex cuda 1 0)
+
+	NVCC_FLAGS="${NVCCFLAGS}" \
+		MAX_JOBS="$(get_makeopts_jobs)" \
+		distutils-r1_python_compile -j1
+}
+
+python_test() {
+	rm -rf torchvision || die
+	local EPYTEST_DESELECT=(
+		test/test_extended_models.py::TestHandleLegacyInterface::test_pretrained_pos
+		test/test_extended_models.py::TestHandleLegacyInterface::test_equivalent_behavior_weights
+		test/test_extended_models.py::test_get_model[lraspp_mobilenet_v3_large-LRASPP]
+		test/test_image.py::test_decode_gif
+		test/test_image.py::test_decode_gif[True-earth]
+		test/test_internet.py::TestDatasetUtils::test_download_url_dispatch_download_from_google_drive[True]
+		test/test_internet.py::TestDatasetUtils::test_download_url_dispatch_download_from_google_drive[False]
+		test/test_transforms_v2.py::TestResize::test_bounding_boxes_correctness[resize-False-size4-BoundingBoxFormat.XYWHR]
+		test/test_transforms_v2.py::TestResize::test_bounding_boxes_correctness[resize-False-size5-BoundingBoxFormat.XYWHR]
+		test/test_transforms_v2.py::TestResize::test_bounding_boxes_correctness[Resize-False-size4-BoundingBoxFormat.XYWHR]
+		test/test_transforms_v2.py::TestResize::test_bounding_boxes_correctness[Resize-False-size5-BoundingBoxFormat.XYWHR]
+	)
+	epytest
+}