1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
#include "tensorflow/core/framework/op.h"
namespace tensorflow {
REGISTER_OP("RandomUniform")
.Input("shape: T")
.SetIsStateful()
.Output("output: dtype")
.Attr("seed: int = 0")
.Attr("seed2: int = 0")
.Attr("dtype: {float,double}")
.Attr("T: {int32, int64}")
.Doc(R"doc(
Outputs random values from a uniform distribution.
The generated values follow a uniform distribution in the range `[0, 1)`. The
lower bound 0 is included in the range, while the upper bound 1 is excluded.
shape: The shape of the output tensor.
dtype: The type of the output.
seed: If either `seed` or `seed2` are set to be non-zero, the random number
generator is seeded by the given seed. Otherwise, it is seeded by a
random seed.
seed2: A second seed to avoid seed collision.
output: A tensor of the specified shape filled with uniform random values.
)doc");
REGISTER_OP("RandomStandardNormal")
.Input("shape: T")
.SetIsStateful()
.Output("output: dtype")
.Attr("seed: int = 0")
.Attr("seed2: int = 0")
.Attr("dtype: {float,double}")
.Attr("T: {int32, int64}")
.Doc(R"doc(
Outputs random values from a normal distribution.
The generated values will have mean 0 and standard deviation 1.
shape: The shape of the output tensor.
dtype: The type of the output.
seed: If either `seed` or `seed2` are set to be non-zero, the random number
generator is seeded by the given seed. Otherwise, it is seeded by a
random seed.
seed2: A second seed to avoid seed collision.
output: A tensor of the specified shape filled with random normal values.
)doc");
REGISTER_OP("TruncatedNormal")
.Input("shape: T")
.SetIsStateful()
.Output("output: dtype")
.Attr("seed: int = 0")
.Attr("seed2: int = 0")
.Attr("dtype: {float,double}")
.Attr("T: {int32, int64}")
.Doc(R"doc(
Outputs random values from a truncated normal distribution.
The generated values follow a normal distribution with mean 0 and standard
deviation 1, except that values whose magnitude is more than 2 standard
deviations from the mean are dropped and re-picked.
shape: The shape of the output tensor.
dtype: The type of the output.
seed: If either `seed` or `seed2` are set to be non-zero, the random number
generator is seeded by the given seed. Otherwise, it is seeded by a
random seed.
seed2: A second seed to avoid seed collision.
output: A tensor of the specified shape filled with random truncated normal
values.
)doc");
REGISTER_OP("RandomShuffle")
.Input("value: T")
.SetIsStateful()
.Output("output: T")
.Attr("seed: int = 0")
.Attr("seed2: int = 0")
.Attr("T: type")
.Doc(R"doc(
Randomly shuffles a tensor along its first dimension.
The tensor is shuffled along dimension 0, such that each `value[j]` is mapped
to one and only one `output[i]`. For example, a mapping that might occur for a
3x2 tensor is:
```prettyprint
[[1, 2], [[5, 6],
[3, 4], ==> [1, 2],
[5, 6]] [3, 4]]
```
value: The tensor to be shuffled.
seed: If either `seed` or `seed2` are set to be non-zero, the random number
generator is seeded by the given seed. Otherwise, it is seeded by a
random seed.
seed2: A second seed to avoid seed collision.
output: A tensor of same shape and type as `value`, shuffled along its first
dimension.
)doc");
} // namespace tensorflow
|