Commit Graph

166 Commits

Author SHA1 Message Date
Sam Gross
ecbc4b0dc3
Fix float uniform generation in TH (#3541)
Generate random uniform floats in the range [0, 1) by generating random
uniform uint32 in the range [0, 2^24-1] and dividing by 2^24. This
ensures that the largest value is representable as a float32 less than
one.

This also changes the uniform double generation to use more bits of
randomness.
2017-11-07 16:26:11 -05:00
avmgithub
68116d7f84 Fix test_torch.py test for Power see issue #3277 (#3517) 2017-11-06 18:51:02 -05:00
Richard Zou
3d06a1e075 Make THCTensor_varInnermostDim numerically stable using Welford's algorithm (#3425)
* Use Welford's algorithm when reducing along inner dimension for THCTensor's variance fn

* Use accreals in THCTensor's varInnermostDim

* Skip cuda tests if no cuda

* Variance testing
2017-11-06 16:00:29 -05:00
SsnL
8fd171a6fd add test_index to test_cuda 2017-11-06 14:21:31 -05:00
SsnL
0bb0ee883e relax index dim check 2017-11-06 14:21:31 -05:00
Dhanton
74d1bb54e6 Add single argument version of torch.arange (#3494) 2017-11-06 12:26:04 -05:00
Richard Zou
e11d2b9c9c Better error messages for Aten tensor types (#3449)
* Better error messages for Aten tensor types

* Address comments, add unit test
2017-11-03 07:59:05 -04:00
Sam Gross
7c0b16c140 Add torch.take and Tensor.put_ (#3263)
* Add torch.take and Tensor.put_

These are similar to numpy.take and numpy.put. The take function allows
you to linearly index into a tensor without viewing it as a 1D tensor
first. The output has the same shape as the indices. The put function
copies value into a tensor also using linear indices.
2017-11-01 06:04:44 -04:00
Richard Zou
81b995514e Make THTensor_(var) and THTensor_(std) more numerically stable (#3410) 2017-10-31 18:36:26 -04:00
Filip Binkiewicz
e4a3747cd8 Add unit tests for casting onto scalars 2017-10-31 08:51:55 -04:00
albanD
1ae10a4831 add test to check zero_strided tensors in blas level 2 and 3 functions 2017-10-30 16:00:21 -04:00
Priya Goyal
129336cb06 [dlpack] Memory management for dlpack 2017-10-21 20:19:51 +02:00
Richard Zou
ed9c43774c Don't resize output in cpu torch.gels (#3204)
* Don't resize output in cpu torch.gels when m > n
2017-10-21 00:43:42 +02:00
SsnL
634c8315a4 isContiguous problems (#3148)
* with the size=1 case, impossible to do single point check, replace with isContiguousRange

* fix stride in desc; fix undef scope

* add test for this case for cudnn

* assertTrue
2017-10-20 10:20:33 -04:00
SsnL
38f87cc9c4 Limit print scale by sys.float_info (#3113)
* limit print scale by sys.float_info

* test print tiny/huge values in test_print

* fix lint
2017-10-14 08:52:01 +02:00
Priya Goyal
756ab3f24f Adding conversion from python tensor to dlpack tensor (#2933) 2017-10-04 08:35:42 -04:00
Holger Kohr
fa8044d92f Add tests for array interface 2017-10-03 10:27:56 -04:00
Taehoon Lee
5d9de014bd Fix typos 2017-10-01 03:09:25 -04:00
gchanan
805ad16924 Support "expanding" an empty tensor to an empty tensor. (#2824)
This doesn't currently support expanding the sizes to (0,), but
we can handle that eventually at the ATen level.
2017-09-22 11:58:03 -04:00
IraKorshunova
2b9765ad02 Erf and erfinv (#2799) 2017-09-20 21:23:45 -04:00
Trevor Killeen
9c39e8cecb Parity with NumPy newaxis placement in indexing (#2779) 2017-09-19 10:38:18 -04:00
Gregory Chanan
08eb88f3de Duplicate what is tested in function tests in the method tests.
Also make some function-vs-method tests uniform and change method
tests so they will pass gradchecks (i.e. avoid nans)
2017-09-12 21:07:48 -04:00
Francisco Massa
1da87118cc Optimize pow for different exponents and add tests 2017-09-10 13:51:05 -04:00
Trevor Killeen
8820d467d6 handle useless ellipsis in advanced indexing (#2589) 2017-09-01 14:27:47 -04:00
Trevor Killeen
26cdfcd9cf allow single non-tuple sequence to trigger advanced indexing (#2323) 2017-09-01 00:28:45 -04:00
Alykhan Tejani
bc228b2409 auto_gpu:True for ones_like and zeros_like (#2559) 2017-08-29 09:51:36 -04:00
Zhou Mo
2c07f88ea3 Fix typos. 2017-08-25 14:27:07 -04:00
Alykhan Tejani
eb58740651 add ones_like and zeros_like 2017-08-25 14:11:04 -04:00
rluo
3b155fa305 Not changing dimension size for expand when target size is -1 2017-08-25 14:04:23 -04:00
Anton Osokin
0d34a6451a fixing the bug with squeezing a singleton dimension in torch.min and torch.max 2017-08-16 17:51:48 -04:00
Luca Antiga
21d8465d8b Add test for Tensor creation from NumPy on CPU and CUDA 2017-08-16 17:44:58 -04:00
Gregory Chanan
b3db52fe36 Support __neg__, .neg(), and neg_() for Long, Int, Short tensor types. 2017-08-15 02:51:25 -04:00
Gregory Chanan
50c208a50b Revert "Fix typos."
This reverts commit 4622b33952.
2017-08-10 13:57:00 -04:00
Zhou Mo
4622b33952 Fix typos. 2017-08-08 11:05:38 -04:00
Adam Paszke
e708de37cc Allow keyword args in long_arg options 2017-07-20 01:45:57 -04:00
Trevor Killeen
31894cafdd add support for advanced indexing with less than ndim indexers, ellipsis (#2144) 2017-07-19 15:51:03 -04:00
Trevor Killeen
c4120f34bf move to model with cuda indexing tensors for cuda tensor adv indexing 2017-07-19 11:05:10 -04:00
Luca Antiga
366299f9f3 Wrap unbiased flag in var, std, varall, stdall 2017-07-14 17:29:06 -04:00
lynic
54cabb8bf3 Correct negative dim behavior in torch.stack (#2084)
Fixes #1950
2017-07-13 16:29:31 -04:00
lynic
f98c384973 Raise error when call from_numpy on 0-dim array (#2075)
* Raise error when call from_numpy on 0-dim array

Fixes: #2055

* reword error message
2017-07-13 09:56:12 -04:00
Christian Sarofeen
27da4eafc2 Remove more advanced indexing duplicate tests (#2071) 2017-07-13 00:30:52 -04:00
Sam Gross
841173c530 Use NamedTemporaryFile to avoid filename collisions (#2069) 2017-07-12 17:14:42 -04:00
albanD
a74fb22b9a fix inplace division for python3 (#2063) 2017-07-12 11:37:55 -04:00
Sam Gross
10e23943b3 Fix missing _forward_pre_hooks in serialized modules (#2057) 2017-07-11 18:23:35 -04:00
Trevor Killeen
10a8ccf27f only test gets for advanced indexing with duplicates (#2041) 2017-07-10 16:05:55 -04:00
lynic
90d0762d14 Use torch.arange instead of torch.range in test_torch.py (#1996) 2017-07-07 00:06:31 -04:00
Alykhan Tejani
5964394a4c return empty iter when tensor is empty 2017-07-04 17:29:27 -04:00
Luca Antiga
05c2bafc9d Have median reduce over all dims and return just the value when dim is not provided 2017-07-04 14:55:37 -04:00
Ethan Luo
406040f6a9 fix torch.is_tensor not recognizing HalfTensor (#1934) 2017-07-02 10:13:44 -04:00
Sam Gross
8a4eb50ed1 Speed up torch.matmul for 3D+ x 2D/1D tensors (#1931)
If the left tensor is 3D+ and the right tensor is at most 2D, we can
fold the batch into the matrix dimension and use torch.mm instead of
torch.bmm. In practice, this is faster especially if the right tensor is
column major.
2017-06-28 17:43:21 -04:00