Skip to content

Commit

Permalink
2024-02-06 nightly release (36d0e3e)
Browse files Browse the repository at this point in the history
  • Loading branch information
pytorchbot committed Feb 6, 2024
1 parent 1cf8291 commit 5c1cb63
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
matrix:
include:
- runner: macos-12
- runner: macos-m1-12
- runner: macos-m1-stable
fail-fast: false
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-conda-m1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
post-script: ${{ matrix.post-script }}
package-name: ${{ matrix.package-name }}
smoke-test-script: ${{ matrix.smoke-test-script }}
runner-type: macos-m1-12
runner-type: macos-m1-stable
trigger-event: ${{ github.event_name }}
secrets:
CONDA_PYTORCHBOT_TOKEN: ${{ secrets.CONDA_PYTORCHBOT_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-wheels-m1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ jobs:
pre-script: ${{ matrix.pre-script }}
post-script: ${{ matrix.post-script }}
package-name: ${{ matrix.package-name }}
runner-type: macos-m1-12
runner-type: macos-m1-stable
smoke-test-script: ${{ matrix.smoke-test-script }}
trigger-event: ${{ github.event_name }}
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
runner: ["macos-12"]
include:
- python-version: "3.8"
runner: macos-m1-12
runner: macos-m1-stable
fail-fast: false
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
with:
Expand Down
5 changes: 5 additions & 0 deletions test/test_transforms_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -5182,6 +5182,11 @@ def test_functional_and_transform(self, make_input, fn):
if isinstance(input, torch.Tensor):
assert output.data_ptr() == input.data_ptr()

def test_2d_np_array(self):
# Non-regression test for https://github.com/pytorch/vision/issues/8255
input = np.random.rand(10, 10)
assert F.to_image(input).shape == (1, 10, 10)

def test_functional_error(self):
with pytest.raises(TypeError, match="Input can either be a pure Tensor, a numpy array, or a PIL image"):
F.to_image(object())
Expand Down
2 changes: 1 addition & 1 deletion torchvision/transforms/v2/functional/_type_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
def to_image(inpt: Union[torch.Tensor, PIL.Image.Image, np.ndarray]) -> tv_tensors.Image:
"""See :class:`~torchvision.transforms.v2.ToImage` for details."""
if isinstance(inpt, np.ndarray):
output = torch.from_numpy(inpt).permute((2, 0, 1)).contiguous()
output = torch.from_numpy(np.atleast_3d(inpt)).permute((2, 0, 1)).contiguous()
elif isinstance(inpt, PIL.Image.Image):
output = pil_to_tensor(inpt)
elif isinstance(inpt, torch.Tensor):
Expand Down

0 comments on commit 5c1cb63

Please sign in to comment.