Thanks to visit codestin.com
Credit goes to github.com

Skip to content

replace torch.Tensor with torch.empty#1578

Merged
crcrpar merged 3 commits into
NVIDIA:masterfrom
NouamaneTazi:fix-tensor
Feb 13, 2023
Merged

replace torch.Tensor with torch.empty#1578
crcrpar merged 3 commits into
NVIDIA:masterfrom
NouamaneTazi:fix-tensor

Conversation

@NouamaneTazi
Copy link
Copy Markdown
Contributor

@NouamaneTazi NouamaneTazi commented Feb 6, 2023

Use torch.empty to initialize tensors instead of torch.Tensor which uses the new constructor.

One benefit for this is that we can pass device and dtype directly to torch.empty whereas we can't for torch.Tensor

@NouamaneTazi NouamaneTazi changed the title replace torch.Tensor with torch.tensor replace torch.Tensor with torch.empty Feb 6, 2023
Copy link
Copy Markdown
Collaborator

@crcrpar crcrpar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, looks good
Just so you know, we're going to remove apex/amp and apex/RNN.

@crcrpar crcrpar added this to the 23.03 milestone Feb 13, 2023
@crcrpar crcrpar merged commit ba027dd into NVIDIA:master Feb 13, 2023
@MozerWang
Copy link
Copy Markdown

BUG!
torch.empty() must have params.

hubertlu-tw pushed a commit to ROCm/apex that referenced this pull request Feb 27, 2023
* replace torch.Tensor with torch.empty

* nit

* nit
hubertlu-tw added a commit to ROCm/apex that referenced this pull request Mar 1, 2023
…cy on six (#107)

* replace torch.Tensor with torch.empty (NVIDIA#1578)

* replace torch.Tensor with torch.empty

* nit

* nit

* torch.empty() must have args (NVIDIA#1584)

* use `torch.tensor` to create a tensor with initializer values (NVIDIA#1588)

* use `torch.tensor` with init values

Signed-off-by: Masaki Kozuki <[email protected]>

* Update apex/contrib/sparsity/sparse_masklib.py

* remove torch._six

Signed-off-by: Masaki Kozuki <[email protected]>

* retire `torch._six`

as per the upstream commit of `b005ec62b9`.

Signed-off-by: Masaki Kozuki <[email protected]>

* use std collections.abc

Signed-off-by: Masaki Kozuki <[email protected]>

---------

Signed-off-by: Masaki Kozuki <[email protected]>

---------

Signed-off-by: Masaki Kozuki <[email protected]>
Co-authored-by: Nouamane Tazi <[email protected]>
Co-authored-by: Masaki Kozuki <[email protected]>
yuanzhedong pushed a commit to yuanzhedong/apex that referenced this pull request Jul 14, 2023
* replace torch.Tensor with torch.empty

* nit

* nit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants