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:
gchanan
2018-03-27 15:27:23 -04:00
committed by GitHub
parent a3d08de331
commit db53389761
14 changed files with 261 additions and 144 deletions

View File

@ -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