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 · lifemd/TensorFlow.NET · GitHub
lifemd
/
TensorFlow.NET
Public
forked from
SciSharp/TensorFlow.NET
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
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
59 lines (51 loc) · 1.68 KB
Breadcrumbs
TensorFlow.NET
/
src
/
TensorFlowNET.Core
/
APIs
/
tf.math.cs
Copy path
File metadata and controls
59 lines (51 loc) · 1.68 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
using
System
;
using
System
.
Collections
.
Generic
;
using
System
.
Text
;
namespace
Tensorflow
{
public
static
partial
class
tf
{
public
static
Tensor
add
(
Tensor
a
,
Tensor
b
)
{
return
gen_math_ops
.
add
(
a
,
b
)
;
}
public
static
Tensor
sub
(
Tensor
a
,
Tensor
b
)
{
return
gen_math_ops
.
sub
(
a
,
b
)
;
}
public
static
Tensor
multiply
(
Tensor
x
,
Tensor
y
)
{
return
gen_math_ops
.
mul
(
x
,
y
)
;
}
public
static
Tensor
pow
(
Tensor
x
,
double
y
)
{
return
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
)
{
Tensor
rank
;
string
name
;
using
(
var
namescop
=
new
ops
.
name_scope
<
Tensor
>
(
""
,
"Rank"
,
new
List
<
Tensor
>
{
input
}
)
)
{
name
=
namescop
;
rank
=
gen_array_ops
.
rank
(
input
,
namescop
)
;
}
using
(
var
namescope
=
new
ops
.
name_scope
<
Tensor
>
(
"range"
,
"Range"
,
new
List
<
Tensor
>
{
0D
,
input
,
1D
}
)
)
{
name
=
namescope
;
var
start
=
ops
.
convert_to_tensor
(
0D
)
;
var
limit
=
ops
.
convert_to_tensor
(
input
)
;
var
delta
=
ops
.
convert_to_tensor
(
1D
)
;
var
t
=
gen_math_ops
.
range
(
start
,
limit
,
delta
,
name
)
;
}
var
s
=
gen_math_ops
.
sum
(
input
,
rank
)
;
return
s
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL