fix UserWarning from slow tensor conversion (#1948)

* fix UserWarning from slow tensor conversion

* Add latest docstring and tutorial changes

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
mathislucka 2022-01-05 22:42:54 +01:00 committed by GitHub
parent 30ea1d475d
commit db76a5c5c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,7 +62,7 @@ def convert_features_to_dataset(features):
"Converting now to a tensor of default type long.")
# Convert all remaining python objects to torch long tensors
cur_tensor = torch.tensor([sample[t_name] for sample in features], dtype=torch.long)
cur_tensor = torch.as_tensor(np.array([sample[t_name] for sample in features]), dtype=torch.long)
all_tensors.append(cur_tensor)