Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow converting CharTensor to np arrays #14710

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions test/test_torch.py
Expand Up @@ -8628,6 +8628,8 @@ def test_numpy_unresizable(self):
def test_toNumpy(self):
types = [
'torch.ByteTensor',
'torch.CharTensor',
'torch.ShortTensor',
'torch.IntTensor',
'torch.HalfTensor',
'torch.FloatTensor',
Expand Down
1 change: 1 addition & 0 deletions torch/csrc/utils/tensor_numpy.cpp
Expand Up @@ -152,6 +152,7 @@ static int aten_to_dtype(const at::Type& type) {
case kLong: return NPY_INT64;
case kInt: return NPY_INT32;
case kShort: return NPY_INT16;
case kChar: return NPY_INT8;
case kByte: return NPY_UINT8;
default: break;
}
Expand Down