Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
aec85d29
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看板
提交
aec85d29
编写于
8月 04, 2020
作者:
E
ervinzhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
applied minor fixes
上级
71982329
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
31 addition
and
135 deletion
+31
-135
build.sh
build.sh
+0
-6
mindspore/ccsrc/minddata/dataset/api/execute.cc
mindspore/ccsrc/minddata/dataset/api/execute.cc
+1
-1
mindspore/ccsrc/minddata/dataset/include/de_tensor.h
mindspore/ccsrc/minddata/dataset/include/de_tensor.h
+29
-26
mindspore/lite/test/ut/src/dataset/de_tensor_test.cc
mindspore/lite/test/ut/src/dataset/de_tensor_test.cc
+1
-1
mindspore/lite/test/ut/src/dataset/eager_test.cc
mindspore/lite/test/ut/src/dataset/eager_test.cc
+0
-101
未找到文件。
build.sh
浏览文件 @
aec85d29
...
...
@@ -519,11 +519,6 @@ build_opencl() {
fi
}
build_gtest
()
{
cd
${
BASEPATH
}
git submodule update
--init
--recursive
third_party/googletest
}
build_opencv
()
{
cd
${
BASEPATH
}
if
[[
"
${
INC_BUILD
}
"
==
"off"
]]
;
then
...
...
@@ -566,7 +561,6 @@ build_minddata_lite_deps()
build_opencv
build_eigen
build_jpeg_turbo
build_gtest
}
build_lite
()
...
...
mindspore/ccsrc/minddata/dataset/api/execute.cc
浏览文件 @
aec85d29
...
...
@@ -46,7 +46,7 @@ std::shared_ptr<tensor::MSTensor> Execute::operator()(std::shared_ptr<tensor::MS
MS_LOG
(
ERROR
)
<<
"Operation execution failed : "
<<
rc
.
ToString
();
return
nullptr
;
}
return
std
::
shared_ptr
<
tensor
::
MSTensor
>
(
new
tensor
::
DETensor
(
std
::
move
(
de_output
)
));
return
std
::
make_shared
<
tensor
::
DETensor
>
(
std
::
move
(
de_output
));
}
...
...
mindspore/ccsrc/minddata/dataset/include/de_tensor.h
浏览文件 @
aec85d29
#ifndef DATASET_INCLUDE_DETENSOR_H_
#define DATASET_INCLUDE_DETENSOR_H_
#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_API_DETENSOR_H_
#define MINDSPORE_CCSRC_MINDDATA_DATASET_API_DETENSOR_H_
#include "include/ms_tensor.h"
#include "minddata/dataset/include/tensor.h"
#include "minddata/dataset/util/status.h"
...
...
@@ -8,46 +7,50 @@ namespace mindspore {
namespace
tensor
{
class
DETensor
:
public
MSTensor
{
public:
// brief Create a MSTensor pointer.
//
// param data_type DataTypeId of tensor to be created.
// param shape Shape of tensor to be created.
// return MSTensor pointer.
static
MSTensor
*
CreateTensor
(
TypeId
data_type
,
const
std
::
vector
<
int
>
&
shape
);
/// \brief Create a MSTensor pointer.
/// \param[data_type] DataTypeId of tensor to be created.
/// \param[shape] Shape of tensor to be created.
/// \return - MSTensor pointer.
static
MSTensor
*
CreateTensor
(
TypeId
data_type
,
const
std
::
vector
<
int
>
&
shape
);
static
MSTensor
*
CreateTensor
(
const
std
::
string
&
path
);
/// \brief Create a MSTensor pointer.
/// \param[path] Path file to be read.
/// \return - MSTensor pointer.
static
MSTensor
*
CreateTensor
(
const
std
::
string
&
path
);
DETensor
(
TypeId
data_type
,
const
std
::
vector
<
int
>
&
shape
);
DETensor
(
TypeId
data_type
,
const
std
::
vector
<
int
>
&
shape
);
explicit
DETensor
(
std
::
shared_ptr
<
dataset
::
Tensor
>
tensor_ptr
);
explicit
DETensor
(
std
::
shared_ptr
<
dataset
::
Tensor
>
tensor_ptr
);
~
DETensor
()
=
default
;
~
DETensor
()
=
default
;
MSTensor
*
ConvertToLiteTensor
();
/// \brief Create a duplicate instance, convert the DETensor to the LiteTensor.
/// \return - MSTensor pointer.
MSTensor
*
ConvertToLiteTensor
();
std
::
shared_ptr
<
dataset
::
Tensor
>
tensor
()
const
;
std
::
shared_ptr
<
dataset
::
Tensor
>
tensor
()
const
;
TypeId
data_type
()
const
override
;
TypeId
data_type
()
const
override
;
TypeId
set_data_type
(
const
TypeId
data_type
)
override
;
TypeId
set_data_type
(
const
TypeId
data_type
)
override
;
std
::
vector
<
int
>
shape
()
const
override
;
std
::
vector
<
int
>
shape
()
const
override
;
size_t
set_shape
(
const
std
::
vector
<
int
>
&
shape
)
override
;
size_t
set_shape
(
const
std
::
vector
<
int
>
&
shape
)
override
;
int
DimensionSize
(
size_t
index
)
const
override
;
int
DimensionSize
(
size_t
index
)
const
override
;
int
ElementsNum
()
const
override
;
int
ElementsNum
()
const
override
;
std
::
size_t
hash
()
const
override
;
std
::
size_t
hash
()
const
override
;
size_t
Size
()
const
override
;
size_t
Size
()
const
override
;
void
*
MutableData
()
const
override
;
void
*
MutableData
()
const
override
;
protected:
std
::
shared_ptr
<
dataset
::
Tensor
>
tensor_impl_
;
std
::
shared_ptr
<
dataset
::
Tensor
>
tensor_impl_
;
};
}
// namespace tensor
}
// namespace mindspore
#endif // DATASET_INCLUDE_DETENSOR_H_
\ No newline at end of file
#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_API_DETENSOR_H_
\ No newline at end of file
mindspore/lite/test/ut/src/dataset/de_tensor_test.cc
浏览文件 @
aec85d29
/**
* Copyright 20
19
Huawei Technologies Co., Ltd
* Copyright 20
20
Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
mindspore/lite/test/ut/src/dataset/eager_test.cc
浏览文件 @
aec85d29
...
...
@@ -62,104 +62,3 @@ TEST_F(MindDataTestEager, Test1) {
double
elapsed_time_ms
=
std
::
chrono
::
duration
<
double
,
std
::
milli
>
(
t_end
-
t_start
).
count
();
MS_LOG
(
INFO
)
<<
"duration: "
<<
elapsed_time_ms
<<
" ms
\n
"
;
}
/*
TEST_F(MindDataTestEager, Test2) {
// string dir for image folder
std::string in_dir = datasets_root_path_ + "/testPK/data";
// run dataset with decode = on
std::shared_ptr<Dataset> ds = ImageFolder(in_dir, true, RandomSampler(false));
std::shared_ptr<TensorOperation> normalize_op = vision::Normalize({121.0, 115.0, 100.0}, {70.0, 68.0, 71.0});
EXPECT_TRUE(normalize_op != nullptr);
std::shared_ptr<TensorOperation> resize_op = vision::Resize({224, 224});
EXPECT_TRUE(resize_op != nullptr);
ds = ds->Map({normalize_op, resize_op});
EXPECT_TRUE(ds != nullptr);
// Create an iterator over the result of the above dataset
// This will trigger the creation of the Execution Tree and launch it.
std::shared_ptr<Iterator> iter = ds->CreateIterator();
EXPECT_TRUE(iter != nullptr);
// Iterate the dataset and get each row
std::unordered_map<std::string, std::shared_ptr<Tensor>> row;
iter->GetNextRow(&row);
uint64_t i = 0;
while (row.size() != 0) {
i++;
auto image = row["image"];
MS_LOG(INFO) << "Tensor image shape: " << image->shape();
iter->GetNextRow(&row);
}
MS_LOG(WARNING) << i << ".";
iter->Stop();
}
TEST_F(MindDataTestEager, Test3) {
// string dir for image folder
ConfigManager cm = ConfigManager();
cm.set_num_parallel_workers(1);
std::string in_dir = datasets_root_path_ + "/testPK/data";
// run dataset with decode = on
std::shared_ptr<Dataset> ds = ImageFolder(in_dir, true, RandomSampler(false));
std::shared_ptr<TensorOperation> normalize_op = vision::Normalize({121.0, 115.0, 100.0}, {70.0, 68.0, 71.0});
EXPECT_TRUE(normalize_op != nullptr);
std::shared_ptr<TensorOperation> resize_op = vision::Resize({224, 224});
EXPECT_TRUE(resize_op != nullptr);
ds = ds->Map({normalize_op, resize_op});
EXPECT_TRUE(ds != nullptr);
// Create an iterator over the result of the above dataset
// This will trigger the creation of the Execution Tree and launch it.
std::shared_ptr<Iterator> iter = ds->CreateIterator();
EXPECT_TRUE(iter != nullptr);
// Iterate the dataset and get each row
std::unordered_map<std::string, std::shared_ptr<Tensor>> row;
iter->GetNextRow(&row);
uint64_t i = 0;
while (row.size() != 0) {
i++;
auto image = row["image"];
MS_LOG(INFO) << "Tensor image shape: " << image->shape();
iter->GetNextRow(&row);
}
MS_LOG(WARNING) << i << ".";
iter->Stop();
}
TEST_F(MindDataTestEager, Test4) {
// string dir for image folder
ConfigManager cm = ConfigManager();
cm.set_num_parallel_workers(1);
std::string in_dir = datasets_root_path_ + "/testPK/data";
// run dataset with decode = on
std::shared_ptr<Dataset> ds = ImageFolder(in_dir, true, RandomSampler(false));
// Create an iterator over the result of the above dataset
// This will trigger the creation of the Execution Tree and launch it.
std::shared_ptr<Iterator> iter = ds->CreateIterator();
EXPECT_TRUE(iter != nullptr);
// Iterate the dataset and get each row
std::unordered_map<std::string, std::shared_ptr<Tensor>> row;
iter->GetNextRow(&row);
uint64_t i = 0;
while (row.size() != 0) {
i++;
auto image = row["image"];
image = Execute(vision::Normalize({121.0, 115.0, 100.0}, {70.0, 68.0, 71.0}))(image);
EXPECT_TRUE(image != nullptr);
image = Execute(vision::Resize({224, 224}))(image);
EXPECT_TRUE(image != nullptr);
MS_LOG(INFO) << "Tensor image shape: " << image->shape();
iter->GetNextRow(&row);
}
MS_LOG(WARNING) << i << ".";
iter->Stop();
}
*/
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录