FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
TensorFlow.NET/src/TensorFlowNET.Core/Tensors/shape_utils.cs at master · feelsyt/TensorFlow.NET · GitHub
feelsyt
/
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
/
Tensors
/
shape_utils.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
44 lines (40 loc) · 1.26 KB
Breadcrumbs
TensorFlow.NET
/
src
/
TensorFlowNET.Core
/
Tensors
/
shape_utils.cs
Copy path
File metadata and controls
44 lines (40 loc) · 1.26 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
using
System
;
using
System
.
Linq
;
using
Tensorflow
.
Eager
;
using
static
Tensorflow
.
Binding
;
namespace
Tensorflow
{
public
class
shape_utils
{
public
static
Tensor
static_or_dynamic_map_fn
(
Func
<
Tensor
,
Tensor
>
fn
,
Tensor
elems
,
TF_DataType
[
]
dtypes
=
null
,
int
parallel_iterations
=
32
,
bool
back_prop
=
true
)
{
var
outputs
=
tf
.
unstack
(
elems
)
.
Select
(
arg
=>
fn
(
arg
)
)
.
ToArray
(
)
;
throw
new
NotImplementedException
(
""
)
;
}
public
static
Shape
from_object_array
(
object
[
]
shape
)
{
var
dims
=
shape
.
Select
(
x
=>
{
if
(
x
is
KerasTensor
kt
&&
kt
.
inferred_value
!=
null
)
{
return
kt
.
inferred_value
.
as_int_list
(
)
[
0
]
;
}
else
if
(
x
is
EagerTensor
et
&&
et
.
dtype
==
TF_DataType
.
TF_INT32
)
{
return
et
.
ToArray
<
int
>
(
)
[
0
]
;
}
else
if
(
x
is
int
i
)
{
return
i
;
}
else
if
(
x
is
long
l
)
{
return
l
;
}
throw
new
NotImplementedException
(
)
;
}
)
.
ToArray
(
)
;
return
new
Shape
(
dims
)
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL