Skip to content

Commit c55cc74

Browse files
killeentsoumith
authored andcommitted
move clamped random functions out of cwrap and into TH
1 parent 763fb5d commit c55cc74

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

torch/csrc/generic/methods/TensorRandom.cwrap

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,6 @@
1515
- long n
1616
]]
1717

18-
#if !defined(TH_REAL_IS_HALF) && !IS_CUDA && !IS_DISTRIBUTED
19-
static void THTensor_(random2__)(THTensor *self, THGenerator *gen, long a, long b)
20-
{
21-
THArgCheck(b > a, 2, "upper bound must be greater than lower bound");
22-
TH_TENSOR_APPLY(real, self, *self_data = ((THRandom_random(gen) % (b-a)) + a);)
23-
}
24-
25-
static void THTensor_(random1__)(THTensor *self, THGenerator *gen, long b)
26-
{
27-
THArgCheck(b > 0, 1, "upper bound must be positive");
28-
TH_TENSOR_APPLY(real, self, *self_data = (THRandom_random(gen) % b);)
29-
}
30-
#endif
31-
3218
[[
3319
name: random_
3420
defined_if: "!IS_DISTRIBUTED"
@@ -42,14 +28,14 @@ static void THTensor_(random1__)(THTensor *self, THGenerator *gen, long b)
4228
- arg: THGenerator* generator
4329
default: THPDefaultGenerator->cdata
4430
kwarg_only: True
45-
- cname: random1__
31+
- cname: cappedRandom
4632
arguments:
4733
- THTensor* self
4834
- arg: THGenerator* generator
4935
default: THPDefaultGenerator->cdata
5036
kwarg_only: True
5137
- long to
52-
- cname: random2__
38+
- cname: clampedRandom
5339
arguments:
5440
- THTensor* self
5541
- arg: THGenerator* generator

0 commit comments

Comments
 (0)