Skip to content

torchvision.utils.save_image modifies the input tensor #1616

@perturbedmuffin

Description

@perturbedmuffin

The issue and example is described in detail here: https://stackoverflow.com/questions/59054886/use-of-torchvision-utils-save-image-twice-on-the-same-image-tensor-makes-the-sec

It seems that when the input tensor to torch.utils.save_image is defined as the sum of two tensors (final_tensor = tensor_1 + tensor_2), save_image modifies the input tensor. This means that when you call save_image again on final_tensor, the image that's printed only corresponds to tensor_1.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions