Skip to content

Conversation

@helunwencser
Copy link
Contributor

Summary:
It turns out that it is unsafe to use torch.empty in oss environment because torch.empty creates tensor with uninitialized data. That means the buffer could be initialized with random values depends on what is left on that piece of memory. This causes code to generate inconsistent behavior.

This PR replaces torch.empty with torch.zeros to make sure that they are properly initialized and avoid inconsistent behaviors.

Differential Revision: D64875312

@pytorch-bot
Copy link

pytorch-bot bot commented Oct 24, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/6478

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit ce906a1 with merge base e93ad5f (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 24, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D64875312

helunwencser pushed a commit to helunwencser/ao that referenced this pull request Oct 25, 2024
Summary:
X-link: pytorch/executorch#6478


It turns out that it is unsafe to use `torch.empty` in oss environment because `torch.empty` creates tensor with uninitialized data. That means the buffer could be initialized with random values depends on what is left on that piece of memory. This causes code to generate inconsistent behavior.

This PR replaces `torch.empty` with `torch.zeros` to make sure that they are properly initialized and avoid inconsistent behaviors.

Reviewed By: msaroufim

Differential Revision: D64875312
helunwencser pushed a commit to helunwencser/executorch that referenced this pull request Oct 25, 2024
Summary:

X-link: pytorch/ao#1157

It turns out that it is unsafe to use `torch.empty` in oss environment because `torch.empty` creates tensor with uninitialized data. That means the buffer could be initialized with random values depends on what is left on that piece of memory. This causes code to generate inconsistent behavior.

This PR replaces `torch.empty` with `torch.zeros` to make sure that they are properly initialized and avoid inconsistent behaviors.

Reviewed By: msaroufim

Differential Revision: D64875312
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D64875312

helunwencser pushed a commit to helunwencser/ao that referenced this pull request Oct 25, 2024
Summary:
X-link: pytorch/executorch#6478


It turns out that it is unsafe to use `torch.empty` in oss environment because `torch.empty` creates tensor with uninitialized data. That means the buffer could be initialized with random values depends on what is left on that piece of memory. This causes code to generate inconsistent behavior.

This PR replaces `torch.empty` with `torch.zeros` to make sure that they are properly initialized and avoid inconsistent behaviors.

Reviewed By: msaroufim

Differential Revision: D64875312
helunwencser pushed a commit to helunwencser/executorch that referenced this pull request Oct 25, 2024
Summary:

X-link: pytorch/ao#1157

It turns out that it is unsafe to use `torch.empty` in oss environment because `torch.empty` creates tensor with uninitialized data. That means the buffer could be initialized with random values depends on what is left on that piece of memory. This causes code to generate inconsistent behavior.

This PR replaces `torch.empty` with `torch.zeros` to make sure that they are properly initialized and avoid inconsistent behaviors.

Reviewed By: msaroufim

Differential Revision: D64875312
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D64875312

helunwencser pushed a commit to helunwencser/ao that referenced this pull request Oct 25, 2024
Summary:
X-link: pytorch/executorch#6478


It turns out that it is unsafe to use `torch.empty` in oss environment because `torch.empty` creates tensor with uninitialized data. That means the buffer could be initialized with random values depends on what is left on that piece of memory. This causes code to generate inconsistent behavior.

This PR replaces `torch.empty` with `torch.zeros` to make sure that they are properly initialized and avoid inconsistent behaviors.

Reviewed By: msaroufim

Differential Revision: D64875312
Summary:

X-link: pytorch/ao#1157

It turns out that it is unsafe to use `torch.empty` in oss environment because `torch.empty` creates tensor with uninitialized data. That means the buffer could be initialized with random values depends on what is left on that piece of memory. This causes code to generate inconsistent behavior.

This PR replaces `torch.empty` with `torch.zeros` to make sure that they are properly initialized and avoid inconsistent behaviors.

Reviewed By: msaroufim

Differential Revision: D64875312
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D64875312

@facebook-github-bot facebook-github-bot merged commit dde3df3 into pytorch:main Oct 25, 2024
45 of 48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants