Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
b111b858
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
b111b858
编写于
5月 25, 2020
作者:
H
heleiwang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix log error
上级
e5c7ecfd
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
21 addition
and
12 deletion
+21
-12
example/graph_to_mindrecord/write_citeseer.sh
example/graph_to_mindrecord/write_citeseer.sh
+6
-3
example/graph_to_mindrecord/write_cora.sh
example/graph_to_mindrecord/write_cora.sh
+6
-3
mindspore/ccsrc/dataset/engine/gnn/graph.cc
mindspore/ccsrc/dataset/engine/gnn/graph.cc
+6
-3
mindspore/ccsrc/dataset/engine/gnn/graph.h
mindspore/ccsrc/dataset/engine/gnn/graph.h
+1
-1
mindspore/dataset/engine/graphdata.py
mindspore/dataset/engine/graphdata.py
+2
-2
未找到文件。
example/graph_to_mindrecord/write_citeseer.sh
浏览文件 @
b111b858
#!/bin/bash
rm
/tmp/citeseer/mindrecord/
*
SRC_PATH
=
/tmp/citeseer/dataset
MINDRECORD_PATH
=
/tmp/citeseer/mindrecord
rm
-f
$MINDRECORD_PATH
/
*
python writer.py
--mindrecord_script
citeseer
\
--mindrecord_file
"
/tmp/citeseer/mindrecord
/citeseer_mr"
\
--mindrecord_file
"
$MINDRECORD_PATH
/citeseer_mr"
\
--mindrecord_partitions
1
\
--mindrecord_header_size_by_bit
18
\
--mindrecord_page_size_by_bit
20
\
--graph_api_args
"
/tmp/citeseer/dataset/citeseer.content:/tmp/citeseer/dataset
/citeseer.cites"
--graph_api_args
"
$SRC_PATH
/citeseer.content:
$SRC_PATH
/citeseer.cites"
example/graph_to_mindrecord/write_cora.sh
浏览文件 @
b111b858
#!/bin/bash
rm
/tmp/cora/mindrecord/
*
SRC_PATH
=
/tmp/cora/dataset
MINDRECORD_PATH
=
/tmp/cora/mindrecord
rm
-f
$MINDRECORD_PATH
/
*
python writer.py
--mindrecord_script
cora
\
--mindrecord_file
"
/tmp/cora/mindrecord
/cora_mr"
\
--mindrecord_file
"
$MINDRECORD_PATH
/cora_mr"
\
--mindrecord_partitions
1
\
--mindrecord_header_size_by_bit
18
\
--mindrecord_page_size_by_bit
20
\
--graph_api_args
"
/tmp/cora/dataset/cora_content.csv:/tmp/cora/dataset
/cora_cites.csv"
--graph_api_args
"
$SRC_PATH
/cora_content.csv:
$SRC_PATH
/cora_cites.csv"
mindspore/ccsrc/dataset/engine/gnn/graph.cc
浏览文件 @
b111b858
...
...
@@ -51,7 +51,7 @@ Status Graph::CreateTensorByVector(const std::vector<std::vector<T>> &data, Data
RETURN_STATUS_UNEXPECTED
(
"Data type not compatible"
);
}
if
(
data
.
empty
())
{
RETURN_STATUS_UNEXPECTED
(
"Input data is emp
l
y"
);
RETURN_STATUS_UNEXPECTED
(
"Input data is emp
t
y"
);
}
std
::
shared_ptr
<
Tensor
>
tensor
;
size_t
m
=
data
.
size
();
...
...
@@ -74,7 +74,7 @@ Status Graph::CreateTensorByVector(const std::vector<std::vector<T>> &data, Data
template
<
typename
T
>
Status
Graph
::
ComplementVector
(
std
::
vector
<
std
::
vector
<
T
>>
*
data
,
size_t
max_size
,
T
default_value
)
{
if
(
!
data
||
data
->
empty
())
{
RETURN_STATUS_UNEXPECTED
(
"Input data is emp
l
y"
);
RETURN_STATUS_UNEXPECTED
(
"Input data is emp
t
y"
);
}
for
(
std
::
vector
<
T
>
&
vec
:
*
data
)
{
size_t
size
=
vec
.
size
();
...
...
@@ -93,6 +93,9 @@ Status Graph::GetEdges(EdgeType edge_type, EdgeIdType edge_num, std::shared_ptr<
Status
Graph
::
GetAllNeighbors
(
const
std
::
vector
<
NodeIdType
>
&
node_list
,
NodeType
neighbor_type
,
std
::
shared_ptr
<
Tensor
>
*
out
)
{
if
(
node_list
.
empty
())
{
RETURN_STATUS_UNEXPECTED
(
"Input node_list is empty."
);
}
if
(
node_type_map_
.
find
(
neighbor_type
)
==
node_type_map_
.
end
())
{
std
::
string
err_msg
=
"Invalid neighbor type:"
+
std
::
to_string
(
neighbor_type
);
RETURN_STATUS_UNEXPECTED
(
err_msg
);
...
...
@@ -147,7 +150,7 @@ Status Graph::GetNodeDefaultFeature(FeatureType feature_type, std::shared_ptr<Fe
Status
Graph
::
GetNodeFeature
(
const
std
::
shared_ptr
<
Tensor
>
&
nodes
,
const
std
::
vector
<
FeatureType
>
&
feature_types
,
TensorRow
*
out
)
{
if
(
!
nodes
||
nodes
->
Size
()
==
0
)
{
RETURN_STATUS_UNEXPECTED
(
"Inpu
de
nodes is empty"
);
RETURN_STATUS_UNEXPECTED
(
"Inpu
t
nodes is empty"
);
}
TensorRow
tensors
;
for
(
auto
f_type
:
feature_types
)
{
...
...
mindspore/ccsrc/dataset/engine/gnn/graph.h
浏览文件 @
b111b858
...
...
@@ -156,7 +156,7 @@ class Graph {
std
::
unordered_map
<
EdgeIdType
,
std
::
shared_ptr
<
Edge
>>
edge_id_map_
;
std
::
unordered_map
<
NodeType
,
std
::
unordered_set
<
FeatureType
>>
node_feature_map_
;
std
::
unordered_map
<
Nod
eType
,
std
::
unordered_set
<
FeatureType
>>
edge_feature_map_
;
std
::
unordered_map
<
Edg
eType
,
std
::
unordered_set
<
FeatureType
>>
edge_feature_map_
;
std
::
unordered_map
<
FeatureType
,
std
::
shared_ptr
<
Feature
>>
default_feature_map_
;
};
...
...
mindspore/dataset/engine/graphdata.py
浏览文件 @
b111b858
...
...
@@ -78,7 +78,7 @@ class GraphData:
>>> import mindspore.dataset as ds
>>> data_graph = ds.GraphData('dataset_file', 2)
>>> nodes = data_graph.get_all_nodes(0)
>>> neighbors = data_graph.get_all_neighbors(nodes
[0]
, 0)
>>> neighbors = data_graph.get_all_neighbors(nodes, 0)
Raises:
TypeError: If `node_list` is not list or ndarray.
...
...
@@ -102,7 +102,7 @@ class GraphData:
>>> import mindspore.dataset as ds
>>> data_graph = ds.GraphData('dataset_file', 2)
>>> nodes = data_graph.get_all_nodes(0)
>>> features = data_graph.get_node_feature(nodes
[0]
, [1])
>>> features = data_graph.get_node_feature(nodes, [1])
Raises:
TypeError: If `node_list` is not list or ndarray.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录