FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
TensorFlow.NET/src/TensorFlowNET.Core/APIs/tf.math.cs at master · lokinfey/TensorFlow.NET · GitHub
lokinfey
/
TensorFlow.NET
Public
forked from
SciSharp/TensorFlow.NET
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
TensorFlow.NET
/
src
/
TensorFlowNET.Core
/
APIs
/
tf.math.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
327 lines (279 loc) · 13.1 KB
Breadcrumbs
TensorFlow.NET
/
src
/
TensorFlowNET.Core
/
APIs
/
tf.math.cs
Copy path
File metadata and controls
327 lines (279 loc) · 13.1 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
using
System
;
using
System
.
Collections
.
Generic
;
using
System
.
Text
;
namespace
Tensorflow
{
public
static
partial
class
tf
{
public
static
Tensor
abs
(
Tensor
x
,
string
name
=
null
)
=>
math_ops
.
abs
(
x
,
name
)
;
/// <summary>
/// Computes acos of x element-wise.
/// </summary>
/// <param name="x"></param>
/// <param name="name"></param>
/// <returns></returns>
public
static
Tensor
acos
(
Tensor
x
,
string
name
=
null
)
=>
gen_math_ops
.
acos
(
x
,
name
)
;
/// <summary>
/// Computes asin of x element-wise.
/// </summary>
/// <param name="x"></param>
/// <param name="name"></param>
/// <returns></returns>
public
static
Tensor
asin
(
Tensor
x
,
string
name
=
null
)
=>
gen_math_ops
.
asin
(
x
,
name
)
;
public
static
Tensor
add
<
Tx
,
Ty
>
(
Tx
a
,
Ty
b
)
=>
gen_math_ops
.
add
(
a
,
b
)
;
/// <summary>
/// Computes atan of x element-wise.
/// </summary>
/// <param name="x"></param>
/// <param name="name"></param>
/// <returns></returns>
public
static
Tensor
atan
(
Tensor
x
,
string
name
=
null
)
=>
gen_math_ops
.
atan
(
x
,
name
)
;
public
static
Tensor
arg_max
(
Tensor
input
,
int
dimension
,
TF_DataType
output_type
=
TF_DataType
.
TF_INT64
,
string
name
=
null
)
=>
gen_math_ops
.
arg_max
(
input
,
dimension
,
output_type
:
output_type
,
name
:
name
)
;
public
static
Tensor
arg_min
(
Tensor
input
,
int
dimension
,
TF_DataType
output_type
=
TF_DataType
.
TF_INT64
,
string
name
=
null
)
=>
gen_math_ops
.
arg_min
(
input
,
dimension
,
output_type
:
output_type
,
name
:
name
)
;
/// <summary>
/// Returns element-wise smallest integer not less than x.
/// </summary>
/// <param name="x"></param>
/// <param name="name"></param>
/// <returns></returns>
public
static
Tensor
ceil
(
Tensor
x
,
string
name
=
null
)
=>
gen_math_ops
.
ceil
(
x
,
name
)
;
/// <summary>
/// Computes sin of x element-wise.
/// </summary>
/// <param name="x"></param>
/// <param name="name"></param>
/// <returns></returns>
public
static
Tensor
sin
(
Tensor
x
,
string
name
=
null
)
=>
gen_math_ops
.
sin
(
x
,
name
)
;
/// <summary>
/// Computes hyperbolic sine of x element-wise.
/// </summary>
/// <param name="x"></param>
/// <param name="name"></param>
/// <returns></returns>
public
static
Tensor
sinh
(
Tensor
x
,
string
name
=
null
)
=>
gen_math_ops
.
sinh
(
x
,
name
)
;
/// <summary>
/// Computes cos of x element-wise.
/// </summary>
/// <param name="x"></param>
/// <param name="name"></param>
/// <returns></returns>
public
static
Tensor
cos
(
Tensor
x
,
string
name
=
null
)
=>
gen_math_ops
.
cos
(
x
,
name
)
;
/// <summary>
/// Computes hyperbolic cosine of x element-wise.
/// </summary>
/// <param name="x"></param>
/// <param name="name"></param>
/// <returns></returns>
public
static
Tensor
cosh
(
Tensor
x
,
string
name
=
null
)
=>
gen_math_ops
.
cosh
(
x
,
name
)
;
public
static
Tensor
tan
(
Tensor
x
,
string
name
=
null
)
=>
gen_math_ops
.
tan
(
x
,
name
)
;
public
static
Tensor
tanh
(
Tensor
x
,
string
name
=
null
)
=>
gen_math_ops
.
tanh
(
x
,
name
)
;
/// <summary>
/// Returns element-wise largest integer not greater than x.
/// </summary>
/// <param name="x"></param>
/// <param name="name"></param>
/// <returns></returns>
public
static
Tensor
floor
(
Tensor
x
,
string
name
=
null
)
=>
gen_math_ops
.
floor
(
x
,
name
)
;
/// <summary>
/// Returns the truth value of (x > y) element-wise.
/// </summary>
/// <typeparam name="Tx"></typeparam>
/// <typeparam name="Ty"></typeparam>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="name"></param>
/// <returns></returns>
public
static
Tensor
greater
<
Tx
,
Ty
>
(
Tx
x
,
Ty
y
,
string
name
=
null
)
=>
gen_math_ops
.
greater
(
x
,
y
,
name
)
;
/// <summary>
/// Returns the truth value of (x >= y) element-wise.
/// </summary>
/// <typeparam name="Tx"></typeparam>
/// <typeparam name="Ty"></typeparam>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="name"></param>
/// <returns></returns>
public
static
Tensor
greater_equal
<
Tx
,
Ty
>
(
Tx
x
,
Ty
y
,
string
name
=
null
)
=>
gen_math_ops
.
greater_equal
(
x
,
y
,
name
)
;
/// <summary>
/// Returns the truth value of (x < y) element-wise.
/// </summary>
/// <typeparam name="Tx"></typeparam>
/// <typeparam name="Ty"></typeparam>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="name"></param>
/// <returns></returns>
public
static
Tensor
less
<
Tx
,
Ty
>
(
Tx
x
,
Ty
y
,
string
name
=
null
)
=>
gen_math_ops
.
less
(
x
,
y
,
name
)
;
/// <summary>
/// Returns the truth value of (x <= y) element-wise.
/// </summary>
/// <typeparam name="Tx"></typeparam>
/// <typeparam name="Ty"></typeparam>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="name"></param>
/// <returns></returns>
public
static
Tensor
less_equal
<
Tx
,
Ty
>
(
Tx
x
,
Ty
y
,
string
name
=
null
)
=>
gen_math_ops
.
less_equal
(
x
,
y
,
name
)
;
/// <summary>
/// Computes natural logarithm of (1 + x) element-wise.
/// </summary>
/// <param name="x"></param>
/// <param name="name"></param>
/// <returns></returns>
public
static
Tensor
log1p
(
Tensor
x
,
string
name
=
null
)
=>
gen_math_ops
.
log1p
(
x
,
name
)
;
/// <summary>
/// Clips tensor values to a specified min and max.
/// </summary>
/// <param name="t"></param>
/// <param name="clip_value_min"></param>
/// <param name="clip_value_max"></param>
/// <param name="name"></param>
/// <returns></returns>
public
static
Tensor
_clip_by_value
(
Tensor
t
,
Tensor
clip_value_min
,
Tensor
clip_value_max
,
string
name
=
null
)
=>
gen_math_ops
.
_clip_by_value
(
t
,
clip_value_min
,
clip_value_max
)
;
public
static
Tensor
sub
(
Tensor
a
,
Tensor
b
)
=>
gen_math_ops
.
sub
(
a
,
b
)
;
public
static
Tensor
divide
(
Tensor
a
,
Tensor
b
)
=>
gen_math_ops
.
real_div
(
a
,
b
)
;
public
static
Tensor
sqrt
(
Tensor
a
,
string
name
=
null
)
=>
gen_math_ops
.
sqrt
(
a
,
name
)
;
public
static
Tensor
subtract
<
T
>
(
Tensor
x
,
T
[
]
y
,
string
name
=
null
)
where
T
:
struct
=>
gen_math_ops
.
sub
(
x
,
ops
.
convert_to_tensor
(
y
,
dtype
:
x
.
dtype
.
as_base_dtype
(
)
,
name
:
"y"
)
,
name
)
;
public
static
Tensor
log
(
Tensor
x
,
string
name
=
null
)
=>
gen_math_ops
.
log
(
x
,
name
)
;
public
static
Tensor
equal
(
Tensor
x
,
Tensor
y
,
string
name
=
null
)
=>
gen_math_ops
.
equal
(
x
,
y
,
name
)
;
/// <summary>
/// Computes arctangent of `y/x` element-wise, respecting signs of the arguments.
/// </summary>
/// <param name="y"></param>
/// <param name="x"></param>
/// <param name="name"></param>
/// <returns></returns>
public
static
Tensor
atan2
(
Tensor
y
,
Tensor
x
,
string
name
=
null
)
=>
gen_math_ops
.
atan2
(
y
,
x
,
name
)
;
/// <summary>
/// Computes the maximum of elements across dimensions of a tensor.
/// </summary>
/// <typeparam name="Tx"></typeparam>
/// <typeparam name="Ty"></typeparam>
/// <param name="input"></param>
/// <param name="axis"></param>
/// <param name="keep_dims"></param>
/// <param name="name"></param>
/// <returns></returns>
public
static
Tensor
max
<
Tx
,
Ty
>
(
Tx
input
,
Ty
axis
,
bool
keep_dims
=
false
,
string
name
=
null
)
=>
gen_math_ops
.
_max
(
input
,
axis
,
keep_dims
:
keep_dims
,
name
:
name
)
;
/// <summary>
/// Computes the minimum of elements across dimensions of a tensor.
/// </summary>
/// <typeparam name="Tx"></typeparam>
/// <typeparam name="Ty"></typeparam>
/// <param name="input"></param>
/// <param name="axis"></param>
/// <param name="keep_dims"></param>
/// <param name="name"></param>
/// <returns></returns>
public
static
Tensor
min
<
Tx
,
Ty
>
(
Tx
input
,
Ty
axis
,
bool
keep_dims
=
false
,
string
name
=
null
)
=>
gen_math_ops
.
_min
(
input
,
axis
,
keep_dims
:
keep_dims
,
name
:
name
)
;
/// <summary>
/// Returns the max of x and y (i.e. x > y ? x : y) element-wise.
/// </summary>
/// <typeparam name="T1"></typeparam>
/// <typeparam name="T2"></typeparam>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="name"></param>
/// <returns></returns>
public
static
Tensor
maximum
<
T1
,
T2
>
(
T1
x
,
T2
y
,
string
name
=
null
)
=>
gen_math_ops
.
maximum
(
x
,
y
,
name
:
name
)
;
/// <summary>
/// Returns the min of x and y (i.e. x < y ? x : y) element-wise.
/// </summary>
/// <typeparam name="T1"></typeparam>
/// <typeparam name="T2"></typeparam>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="name"></param>
/// <returns></returns>
public
static
Tensor
minimum
<
T1
,
T2
>
(
T1
x
,
T2
y
,
string
name
=
null
)
=>
gen_math_ops
.
minimum
(
x
,
y
,
name
:
name
)
;
public
static
Tensor
multiply
<
Tx
,
Ty
>
(
Tx
x
,
Ty
y
)
=>
gen_math_ops
.
mul
(
x
,
y
)
;
public
static
Tensor
negative
(
Tensor
x
,
string
name
=
null
)
=>
gen_math_ops
.
neg
(
x
,
name
)
;
/// <summary>
/// Divides x / y elementwise (using Python 2 division operator semantics).
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="name"></param>
/// <returns></returns>
public
static
Tensor
div
(
Tensor
x
,
Tensor
y
,
string
name
=
null
)
=>
math_ops
.
div
(
x
,
y
,
name
:
name
)
;
public
static
Tensor
divide
<
T
>
(
Tensor
x
,
T
[
]
y
,
string
name
=
null
)
where
T
:
struct
=>
x
/
ops
.
convert_to_tensor
(
y
,
dtype
:
x
.
dtype
.
as_base_dtype
(
)
,
name
:
"y"
)
;
public
static
Tensor
pow
<
T1
,
T2
>
(
T1
x
,
T2
y
)
=>
gen_math_ops
.
pow
(
x
,
y
)
;
/// <summary>
/// Computes the sum of elements across dimensions of a tensor.
/// </summary>
/// <param name="input"></param>
/// <param name="axis"></param>
/// <returns></returns>
public
static
Tensor
reduce_sum
(
Tensor
input
,
int
?
axis
=
null
,
int
?
reduction_indices
=
null
)
{
if
(
!
axis
.
HasValue
&&
reduction_indices
.
HasValue
)
return
math_ops
.
reduce_sum
(
input
,
reduction_indices
.
Value
)
;
return
math_ops
.
reduce_sum
(
input
)
;
}
public
static
Tensor
reduce_sum
(
Tensor
input
,
int
axis
,
int
?
reduction_indices
=
null
)
=>
math_ops
.
reduce_sum
(
input
,
axis
)
;
/// <summary>
/// Computes the maximum of elements across dimensions of a tensor.
/// </summary>
/// <param name="input_tensor"></param>
/// <param name="axis"></param>
/// <param name="keepdims"></param>
/// <param name="name"></param>
/// <returns></returns>
public
static
Tensor
reduce_max
(
Tensor
input_tensor
,
int
[
]
axis
=
null
,
bool
keepdims
=
false
,
string
name
=
null
)
=>
math_ops
.
reduce_max
(
input_tensor
,
axis
,
keepdims
,
name
)
;
public
static
Tensor
reduce_min
(
Tensor
input_tensor
,
int
[
]
axis
=
null
,
bool
keepdims
=
false
,
string
name
=
null
)
=>
math_ops
.
reduce_min
(
input_tensor
,
axis
,
keepdims
,
name
)
;
public
static
Tensor
sigmoid
<
T
>
(
T
x
,
string
name
=
null
)
=>
math_ops
.
sigmoid
(
x
,
name
:
name
)
;
public
static
Tensor
sum
(
Tensor
input
,
int
axis
,
bool
keep_dims
=
false
,
string
name
=
null
)
=>
gen_math_ops
.
_sum
(
input
,
axis
,
keep_dims
:
keep_dims
,
name
:
name
)
;
public
static
Tensor
reduce_mean
(
Tensor
input_tensor
,
int
[
]
axis
=
null
,
bool
keepdims
=
false
,
string
name
=
null
,
int
?
reduction_indices
=
null
)
=>
math_ops
.
reduce_mean
(
input_tensor
,
axis
:
axis
,
keepdims
:
keepdims
,
name
:
name
,
reduction_indices
:
reduction_indices
)
;
public
static
Tensor
round
(
Tensor
x
,
string
name
=
null
)
=>
gen_math_ops
.
round
(
x
,
name
:
name
)
;
public
static
Tensor
cast
(
Tensor
x
,
TF_DataType
dtype
=
TF_DataType
.
DtInvalid
,
string
name
=
null
)
=>
math_ops
.
cast
(
x
,
dtype
,
name
)
;
public
static
Tensor
argmax
(
Tensor
input
,
int
axis
=
-
1
,
string
name
=
null
,
int
?
dimension
=
null
,
TF_DataType
output_type
=
TF_DataType
.
TF_INT64
)
=>
gen_math_ops
.
arg_max
(
input
,
axis
,
name
:
name
,
output_type
:
output_type
)
;
public
static
Tensor
square
(
Tensor
x
,
string
name
=
null
)
=>
gen_math_ops
.
square
(
x
,
name
:
name
)
;
}
}
Back
|
FazBrowse Home
|
New Git URL