mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Add numpy.array-like type inference to torch.tensor. (#5997)
* Add numpy.array-like type inference to torch.tensor. * Temporary fix for int/double types. * Treat python floats as the default (scalar) dtype. * Also make 0-length sequences the default scalar type and add more tests. * Add type inference to sparse_coo_tensor. * Fix sparse test. * Remove allow_variables. * Check numpy platform bits. * Address review comments. * Make suggested changes to constraints. * More checking windows builds. * Fix test for windows.
This commit is contained in:
@ -93,7 +93,7 @@ def broadcast_all(*values):
|
||||
values[idx] = template.new(template.size()).fill_(values[idx])
|
||||
else:
|
||||
for idx in scalar_idxs:
|
||||
values[idx] = torch.tensor(values[idx])
|
||||
values[idx] = torch.tensor(float(values[idx]))
|
||||
return values
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user