Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
0b1d09ae
Commit
0b1d09ae
authored
Aug 18, 2017
by
Scott Cyphers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Type construction, simple value descriptors
parent
8c16125d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
8 deletions
+83
-8
descriptors.hpp
src/values/descriptors.hpp
+39
-4
function.hpp
src/values/function.hpp
+16
-0
types.hpp
src/values/types.hpp
+22
-2
build_graph.cpp
test/build_graph.cpp
+6
-2
No files found.
src/values/descriptors.hpp
View file @
0b1d09ae
...
...
@@ -15,8 +15,13 @@ public:
class
TensorDescriptor
{
public
:
TensorDescriptor
(
const
ElementType
&
element_type
)
:
m_element_type
(
element_type
)
{}
protected
:
ElementType
element_type
;
const
ElementType
&
m_
element_type
;
};
class
TensorLayoutDescriptor
...
...
@@ -27,24 +32,54 @@ class TensorLayoutDescriptor
class
TensorViewDescriptor
:
public
ValueDescriptor
{
public
:
TensorViewDescriptor
(
const
std
::
shared_ptr
<
TensorViewType
>&
type
)
:
m_type
(
type
)
{}
TensorViewDescriptor
(
const
ElementType
&
element_type
,
const
std
::
vector
<
value_size_t
>&
shape
)
:
TensorViewDescriptor
(
TensorViewType
::
make_shared
(
element_type
,
shape
))
{}
static
std
::
shared_ptr
<
TensorViewDescriptor
>
make_shared
(
const
std
::
shared_ptr
<
TensorViewType
>&
type
){
return
std
::
shared_ptr
<
TensorViewDescriptor
>
(
new
TensorViewDescriptor
(
type
));
}
static
std
::
shared_ptr
<
TensorViewDescriptor
>
make_shared
(
const
ElementType
&
element_type
,
const
std
::
vector
<
value_size_t
>&
shape
){
return
std
::
shared_ptr
<
TensorViewDescriptor
>
(
new
TensorViewDescriptor
(
element_type
,
shape
));
}
std
::
shared_ptr
<
ValueType
>
value_type
()
const
override
{
return
m_type
;
}
protected
:
std
::
shared_ptr
<
TensorViewType
>
m_type
;
TensorDescriptor
m_tensor_descriptor
;
TensorLayoutDescriptor
m_tensor_layout_descriptor
;
std
::
shared_ptr
<
TensorDescriptor
>
m_tensor_descriptor
;
std
::
shared_ptr
<
TensorLayoutDescriptor
>
m_tensor_layout_descriptor
;
};
class
TupleDescriptor
:
public
ValueDescriptor
{
public
:
TupleDescriptor
(
const
std
::
vector
<
std
::
shared_ptr
<
ValueDescriptor
>>&
elements
)
:
m_element_descriptors
(
elements
)
{
std
::
vector
<
std
::
shared_ptr
<
ValueType
>>
types
;
for
(
auto
elt
:
elements
){
types
.
push_back
(
elt
->
value_type
());
}
m_type
=
TupleType
::
make_shared
(
types
);
}
static
std
::
shared_ptr
<
TupleDescriptor
>
make_shared
(
const
std
::
vector
<
std
::
shared_ptr
<
ValueDescriptor
>>&
elements
){
return
std
::
shared_ptr
<
TupleDescriptor
>
(
new
TupleDescriptor
(
elements
));
}
std
::
shared_ptr
<
ValueType
>
value_type
()
const
override
{
return
m_type
;
}
protected
:
std
::
shared_ptr
<
TupleType
>
m_type
;
std
::
vector
<
ValueDescriptor
>
m_element_descriptors
;
std
::
vector
<
std
::
shared_ptr
<
ValueDescriptor
>
>
m_element_descriptors
;
};
}
// End of NGRAPH
src/values/function.hpp
0 → 100644
View file @
0b1d09ae
#pragma once
#include "values/descriptors.hpp"
#include "values/types.hpp"
namespace
ngraph
{
class
Function
{
std
::
vector
<
std
::
shared_ptr
<
ValueDescriptor
>>
m_arguments
;
std
::
shared_ptr
<
ValueDescriptor
>
m_result
;
};
}
// end namespace ngraph
\ No newline at end of file
src/values/types.hpp
View file @
0b1d09ae
...
...
@@ -17,16 +17,35 @@ class ValueType
class
TensorViewType
:
public
ValueType
{
public
:
TensorViewType
(
const
ElementType
&
element_type
,
const
std
::
vector
<
value_size_t
>&
shape
)
:
m_element_type
(
element_type
)
,
m_shape
(
shape
)
{}
static
std
::
shared_ptr
<
TensorViewType
>
make_shared
(
const
ElementType
&
element_type
,
const
std
::
vector
<
value_size_t
>&
shape
){
return
std
::
shared_ptr
<
TensorViewType
>
(
new
TensorViewType
(
element_type
,
shape
));
}
protected
:
ElementType
m_element_type
;
TensorViewType
(
const
TensorViewType
&
)
=
delete
;
const
ElementType
&
m_element_type
;
std
::
vector
<
value_size_t
>
m_shape
;
};
class
TupleType
:
public
ValueType
{
public
:
TupleType
(
const
std
::
vector
<
std
::
shared_ptr
<
ValueType
>>&
element_types
)
:
m_element_types
(
element_types
)
{}
static
std
::
shared_ptr
<
TupleType
>
make_shared
(
const
std
::
vector
<
std
::
shared_ptr
<
ValueType
>>&
element_types
){
return
std
::
shared_ptr
<
TupleType
>
(
new
TupleType
(
element_types
));
}
protected
:
// Is this name too similar to TensorViewType.to m_element_type?
std
::
vector
<
ValueType
>
m_element_types
;
std
::
vector
<
std
::
shared_ptr
<
ValueType
>
>
m_element_types
;
};
}
// End of ngraph
\ No newline at end of file
test/build_graph.cpp
View file @
0b1d09ae
...
...
@@ -5,4 +5,9 @@ using namespace ngraph;
void
build_simple_graph
()
{
}
\ No newline at end of file
auto
tv_a
=
TensorViewType
::
make_shared
(
element_type_float
,
{
2
,
3
,
5
});
auto
tp_b
=
TupleType
::
make_shared
({
tv_a
,
tv_a
});
auto
tp_c
=
TupleType
::
make_shared
({
tp_b
,
tv_a
});
auto
tensor_d
=
TensorViewDescriptor
::
make_shared
(
element_type_float
,
{
2
,
3
,
5
});
auto
tuple_d
=
TupleDescriptor
::
make_shared
({
tensor_d
,
tensor_d
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment