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
eb2a4980
Commit
eb2a4980
authored
Aug 19, 2017
by
Scott Cyphers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More plumbing
parent
2504daa1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
102 additions
and
4 deletions
+102
-4
CMakeLists.txt
src/CMakeLists.txt
+2
-0
function.cpp
src/values/function.cpp
+13
-0
function.hpp
src/values/function.hpp
+36
-4
op.hpp
src/values/op.hpp
+46
-0
types.hpp
src/values/types.hpp
+5
-0
No files found.
src/CMakeLists.txt
View file @
eb2a4980
...
...
@@ -27,6 +27,8 @@ set (SRC
transformers/mock_transformer.cpp
transformers/ndarray.cpp
transformers/op_graph.cpp
values/function.cpp
)
# NOTE: We'd prefer to only have the .cpp files *in* the 'transformers' directory be compiled
...
...
src/values/function.cpp
0 → 100644
View file @
eb2a4980
#include "values/function.hpp"
using
namespace
std
;
using
namespace
ngraph
;
Parameter
::
ptr_t
Parameter
::
make
(
Function
&
function
,
size_t
index
,
const
ValueType
::
ptr_t
&
output_type
){
return
ptr_t
(
new
Parameter
(
function
,
index
,
output_type
));
}
Function
::
ptr_t
Function
::
make
(
const
ValueType
::
ptr_t
&
return_type
,
const
std
::
vector
<
ValueType
::
ptr_t
>&
argument_types
){
return
ptr_t
(
new
Function
(
return_type
,
argument_types
));
}
src/values/function.hpp
View file @
eb2a4980
#pragma once
#include "values/descriptors.hpp"
#include "values/op.hpp"
#include "values/types.hpp"
namespace
ngraph
{
class
Function
;
class
Parameter
:
public
Op
{
public
:
using
ptr_t
=
std
::
shared_ptr
<
Parameter
>
;
static
ptr_t
make
(
Function
&
function
,
size_t
index
,
const
ValueType
::
ptr_t
&
output_type
);
protected
:
Parameter
(
Function
&
function
,
size_t
index
,
const
ValueType
::
ptr_t
&
output_type
)
:
Op
({},
output_type
)
,
m_function
(
function
)
,
m_index
(
index
)
{}
Function
&
m_function
;
size_t
m_index
;
};
class
Function
{
public
:
using
ptr_t
=
std
::
shared_ptr
<
Function
>
;
Function
(
const
ValueType
::
ptr_t
&
return_type
,
const
std
::
vector
<
ValueType
::
ptr_t
>&
argument_types
)
protected
:
Function
(
const
ValueType
::
ptr_t
&
return_type
,
const
std
::
vector
<
ValueType
::
ptr_t
>&
argument_types
)
:
m_return_type
(
return_type
)
,
m_argument_types
(
argument_types
)
{}
{
size_t
i
=
0
;
for
(
auto
argument_type
:
argument_types
){
m_parameters
.
push_back
(
Parameter
::
make
(
*
this
,
i
++
,
argument_type
));
}
}
public
:
static
ptr_t
make
(
const
ValueType
::
ptr_t
&
return_type
,
const
std
::
vector
<
ValueType
::
ptr_t
>&
argument_types
);
static
ptr_t
make
(
const
ValueType
::
ptr_t
&
return_type
,
const
std
::
vector
<
ValueType
::
ptr_t
>&
argument_types
){
return
ptr_t
(
new
Function
(
return_type
,
argument_types
))
;
Parameter
::
ptr_t
parameter
(
size_t
i
){
return
m_parameters
[
i
]
;
}
protected
:
std
::
vector
<
Parameter
::
ptr_t
>
m_parameters
;
std
::
vector
<
std
::
shared_ptr
<
ValueType
>>
m_argument_types
;
std
::
shared_ptr
<
ValueType
>
m_return_type
;
};
...
...
src/values/op.hpp
0 → 100644
View file @
eb2a4980
#pragma once
#include <memory>
#include "values/descriptors.hpp"
#include "values/types.hpp"
namespace
ngraph
{
class
Op
{
public
:
using
ptr_t
=
std
::
shared_ptr
<
Op
>
;
protected
:
Op
(
const
std
::
vector
<
ptr_t
>&
inputs
,
const
ValueType
::
ptr_t
output_type
)
:
m_inputs
(
inputs
)
,
m_output_type
(
output_type
)
{}
std
::
vector
<
ptr_t
>
m_inputs
;
ValueType
::
ptr_t
m_output_type
;
};
class
Broadcast
:
public
Op
{
public
:
using
ptr_t
=
std
::
shared_ptr
<
Broadcast
>
;
protected
:
Broadcast
(
const
Op
::
ptr_t
&
x
,
std
::
vector
<
size_t
>
dims
)
:
Op
({
x
},
0
)
,
m_dims
(
dims
)
{}
public
:
static
ptr_t
make
(
const
Op
::
ptr_t
&
x
,
std
::
vector
<
size_t
>
dims
){
return
ptr_t
(
new
Broadcast
(
x
,
dims
));
}
protected
:
std
::
vector
<
size_t
>
m_dims
;
};
}
// end of namespace ngraph
\ No newline at end of file
src/values/types.hpp
View file @
eb2a4980
...
...
@@ -7,6 +7,9 @@
namespace
ngraph
{
class
TensorViewDescriptor
;
class
TupleDescriptor
;
using
value_size_t
=
size_t
;
// Base type for ngraph values
...
...
@@ -20,6 +23,7 @@ class TensorViewType : public ValueType
{
public
:
using
ptr_t
=
std
::
shared_ptr
<
TensorViewType
>
;
using
descriptor_t
=
TensorViewDescriptor
;
TensorViewType
(
const
ElementType
&
element_type
,
const
std
::
vector
<
value_size_t
>&
shape
)
:
m_element_type
(
element_type
)
...
...
@@ -39,6 +43,7 @@ class TupleType : public ValueType
{
public
:
using
ptr_t
=
std
::
shared_ptr
<
TupleType
>
;
using
descriptor_t
=
TupleDescriptor
;
TupleType
(
const
std
::
vector
<
ValueType
::
ptr_t
>&
element_types
)
:
m_element_types
(
element_types
)
...
...
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