Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
b65125b0
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看板
提交
b65125b0
编写于
7月 27, 2020
作者:
N
nhussain
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add more ifdef and include statments for pybind
上级
79225e04
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
70 addition
and
49 deletion
+70
-49
mindspore/ccsrc/minddata/dataset/core/tensor.h
mindspore/ccsrc/minddata/dataset/core/tensor.h
+8
-6
mindspore/ccsrc/minddata/dataset/engine/datasetops/build_sentence_piece_vocab_op.h
...dataset/engine/datasetops/build_sentence_piece_vocab_op.h
+1
-0
mindspore/ccsrc/minddata/dataset/engine/datasetops/source/generator_op.h
.../minddata/dataset/engine/datasetops/source/generator_op.h
+3
-0
mindspore/ccsrc/minddata/dataset/engine/opt/pass.cc
mindspore/ccsrc/minddata/dataset/engine/opt/pass.cc
+10
-10
mindspore/ccsrc/minddata/dataset/engine/opt/pass.h
mindspore/ccsrc/minddata/dataset/engine/opt/pass.h
+4
-4
mindspore/ccsrc/minddata/dataset/engine/opt/pre/cache_transform_pass.cc
...c/minddata/dataset/engine/opt/pre/cache_transform_pass.cc
+25
-20
mindspore/ccsrc/minddata/dataset/engine/opt/pre/cache_transform_pass.h
...rc/minddata/dataset/engine/opt/pre/cache_transform_pass.h
+4
-2
mindspore/ccsrc/minddata/dataset/include/tensor.h
mindspore/ccsrc/minddata/dataset/include/tensor.h
+2
-1
tests/ut/cpp/CMakeLists.txt
tests/ut/cpp/CMakeLists.txt
+1
-0
tests/ut/cpp/dataset/CMakeLists.txt
tests/ut/cpp/dataset/CMakeLists.txt
+12
-6
未找到文件。
mindspore/ccsrc/minddata/dataset/core/tensor.h
浏览文件 @
b65125b0
...
...
@@ -649,12 +649,6 @@ class Tensor {
unsigned
char
*
data_end_
=
nullptr
;
private:
/// Helper function to create a tensor from Numpy array of strings
/// \param[in] arr Numpy array
/// \param[out] out Created Tensor
/// \return Status
static
Status
CreateFromNpString
(
py
::
array
arr
,
TensorPtr
*
out
);
/// Copy raw data of a array based on shape and strides to the destination pointer
/// \param dst [out] Pointer to the destination array where the content is to be copied
/// \param[in] src Pointer to the source of strided array to be copied
...
...
@@ -667,6 +661,14 @@ class Tensor {
/// const of the size of the offset variable
static
constexpr
uint8_t
kOffsetSize
=
sizeof
(
offset_t
);
#ifdef ENABLE_PYTHON
/// Helper function to create a tensor from Numpy array of strings
/// \param[in] arr Numpy array
/// \param[out] out Created Tensor
/// \return Status
static
Status
CreateFromNpString
(
py
::
array
arr
,
TensorPtr
*
out
);
#endif
};
template
<
>
inline
Tensor
::
TensorIterator
<
std
::
string_view
>
Tensor
::
end
<
std
::
string_view
>
()
{
...
...
mindspore/ccsrc/minddata/dataset/engine/datasetops/build_sentence_piece_vocab_op.h
浏览文件 @
b65125b0
...
...
@@ -31,6 +31,7 @@
#include "minddata/dataset/util/status.h"
#include "minddata/dataset/util/queue.h"
#include "minddata/dataset/text/sentence_piece_vocab.h"
#include "pybind11/pybind11.h"
namespace
mindspore
{
namespace
dataset
{
...
...
mindspore/ccsrc/minddata/dataset/engine/datasetops/source/generator_op.h
浏览文件 @
b65125b0
...
...
@@ -27,6 +27,9 @@
#include "minddata/dataset/engine/data_schema.h"
#include "minddata/dataset/engine/datasetops/pipeline_op.h"
#include "minddata/dataset/util/wait_post.h"
#include "pybind11/pybind11.h"
namespace
py
=
pybind11
;
namespace
mindspore
{
namespace
dataset
{
...
...
mindspore/ccsrc/minddata/dataset/engine/opt/pass.cc
浏览文件 @
b65125b0
...
...
@@ -156,6 +156,16 @@ Status NodePass::RunOnNode(std::shared_ptr<GeneratorOp> node, bool *modified) {
// Fallback to base class visitor by default
return
RunOnNode
(
std
::
static_pointer_cast
<
DatasetOp
>
(
node
),
modified
);
}
Status
NodePass
::
RunOnNode
(
std
::
shared_ptr
<
ManifestOp
>
node
,
bool
*
modified
)
{
// Fallback to base class visitor by default
return
RunOnNode
(
std
::
static_pointer_cast
<
DatasetOp
>
(
node
),
modified
);
}
Status
NodePass
::
RunOnNode
(
std
::
shared_ptr
<
VOCOp
>
node
,
bool
*
modified
)
{
// Fallback to base class visitor by default
return
RunOnNode
(
std
::
static_pointer_cast
<
DatasetOp
>
(
node
),
modified
);
}
#endif
Status
NodePass
::
RunOnNode
(
std
::
shared_ptr
<
RandomDataOp
>
node
,
bool
*
modified
)
{
...
...
@@ -193,21 +203,11 @@ Status NodePass::RunOnNode(std::shared_ptr<MnistOp> node, bool *modified) {
return
RunOnNode
(
std
::
static_pointer_cast
<
DatasetOp
>
(
node
),
modified
);
}
Status
NodePass
::
RunOnNode
(
std
::
shared_ptr
<
ManifestOp
>
node
,
bool
*
modified
)
{
// Fallback to base class visitor by default
return
RunOnNode
(
std
::
static_pointer_cast
<
DatasetOp
>
(
node
),
modified
);
}
Status
NodePass
::
RunOnNode
(
std
::
shared_ptr
<
CifarOp
>
node
,
bool
*
modified
)
{
// Fallback to base class visitor by default
return
RunOnNode
(
std
::
static_pointer_cast
<
DatasetOp
>
(
node
),
modified
);
}
Status
NodePass
::
RunOnNode
(
std
::
shared_ptr
<
VOCOp
>
node
,
bool
*
modified
)
{
// Fallback to base class visitor by default
return
RunOnNode
(
std
::
static_pointer_cast
<
DatasetOp
>
(
node
),
modified
);
}
Status
NodePass
::
RunOnNode
(
std
::
shared_ptr
<
CelebAOp
>
node
,
bool
*
modified
)
{
// Fallback to base class visitor by default
return
RunOnNode
(
std
::
static_pointer_cast
<
DatasetOp
>
(
node
),
modified
);
...
...
mindspore/ccsrc/minddata/dataset/engine/opt/pass.h
浏览文件 @
b65125b0
...
...
@@ -165,7 +165,11 @@ class NodePass : public Pass {
#ifdef ENABLE_PYTHON
virtual
Status
RunOnNode
(
std
::
shared_ptr
<
FilterOp
>
node
,
bool
*
modified
);
virtual
Status
RunOnNode
(
std
::
shared_ptr
<
ManifestOp
>
node
,
bool
*
modified
);
virtual
Status
RunOnNode
(
std
::
shared_ptr
<
GeneratorOp
>
node
,
bool
*
modified
);
virtual
Status
RunOnNode
(
std
::
shared_ptr
<
VOCOp
>
node
,
bool
*
modified
);
#endif
virtual
Status
RunOnNode
(
std
::
shared_ptr
<
RandomDataOp
>
node
,
bool
*
modified
);
...
...
@@ -182,12 +186,8 @@ class NodePass : public Pass {
virtual
Status
RunOnNode
(
std
::
shared_ptr
<
MnistOp
>
node
,
bool
*
modified
);
virtual
Status
RunOnNode
(
std
::
shared_ptr
<
ManifestOp
>
node
,
bool
*
modified
);
virtual
Status
RunOnNode
(
std
::
shared_ptr
<
CifarOp
>
node
,
bool
*
modified
);
virtual
Status
RunOnNode
(
std
::
shared_ptr
<
VOCOp
>
node
,
bool
*
modified
);
virtual
Status
RunOnNode
(
std
::
shared_ptr
<
CocoOp
>
node
,
bool
*
modified
);
virtual
Status
RunOnNode
(
std
::
shared_ptr
<
CelebAOp
>
node
,
bool
*
modified
);
...
...
mindspore/ccsrc/minddata/dataset/engine/opt/pre/cache_transform_pass.cc
浏览文件 @
b65125b0
...
...
@@ -24,14 +24,17 @@
#include "minddata/dataset/engine/datasetops/source/celeba_op.h"
#include "minddata/dataset/engine/datasetops/source/cifar_op.h"
#include "minddata/dataset/engine/datasetops/source/coco_op.h"
#include "minddata/dataset/engine/datasetops/source/generator_op.h"
#include "minddata/dataset/engine/datasetops/source/image_folder_op.h"
#include "minddata/dataset/engine/datasetops/source/manifest_op.h"
#include "minddata/dataset/engine/datasetops/source/mindrecord_op.h"
#include "minddata/dataset/engine/datasetops/source/mnist_op.h"
#include "minddata/dataset/engine/datasetops/source/random_data_op.h"
#include "minddata/dataset/engine/datasetops/source/tf_reader_op.h"
#ifdef ENABLE_PYTHON
#include "minddata/dataset/engine/datasetops/source/generator_op.h"
#include "minddata/dataset/engine/datasetops/source/manifest_op.h"
#include "minddata/dataset/engine/datasetops/source/voc_op.h"
#endif
namespace
mindspore
{
namespace
dataset
{
...
...
@@ -120,7 +123,7 @@ Status CacheTransformPass::CachePass::NonMappableCacheLeafSetup(std::shared_ptr<
return
Status
::
OK
();
}
// Perform leaf node cache tran
form identifications
// Perform leaf node cache tran
sform identification
Status
CacheTransformPass
::
CachePass
::
RunOnNode
(
std
::
shared_ptr
<
TFReaderOp
>
node
,
bool
*
modified
)
{
if
(
is_caching_
)
{
// If we are a TF Reader in a caching tree, then change our config so that it becomes a basic
...
...
@@ -130,55 +133,57 @@ Status CacheTransformPass::CachePass::RunOnNode(std::shared_ptr<TFReaderOp> node
return
NonMappableCacheLeafSetup
(
std
::
static_pointer_cast
<
DatasetOp
>
(
node
));
}
// Perform leaf node cache tran
form identifications
// Perform leaf node cache tran
sform identification
Status
CacheTransformPass
::
CachePass
::
RunOnNode
(
std
::
shared_ptr
<
RandomDataOp
>
node
,
bool
*
modified
)
{
return
NonMappableCacheLeafSetup
(
std
::
static_pointer_cast
<
DatasetOp
>
(
node
));
}
// Perform leaf node cache tran
form identifications
// Perform leaf node cache tran
sform identification
Status
CacheTransformPass
::
CachePass
::
RunOnNode
(
std
::
shared_ptr
<
ImageFolderOp
>
node
,
bool
*
modified
)
{
return
MappableCacheLeafSetup
(
std
::
static_pointer_cast
<
DatasetOp
>
(
node
));
}
// Perform leaf node cache tran
form identifications
// Perform leaf node cache tran
sform identification
Status
CacheTransformPass
::
CachePass
::
RunOnNode
(
std
::
shared_ptr
<
MnistOp
>
node
,
bool
*
modified
)
{
return
MappableCacheLeafSetup
(
std
::
static_pointer_cast
<
DatasetOp
>
(
node
));
}
// Perform leaf node cache tran
form identifications
Status
CacheTransformPass
::
CachePass
::
RunOnNode
(
std
::
shared_ptr
<
Generato
rOp
>
node
,
bool
*
modified
)
{
// Perform leaf node cache tran
sform identification
Status
CacheTransformPass
::
CachePass
::
RunOnNode
(
std
::
shared_ptr
<
Cifa
rOp
>
node
,
bool
*
modified
)
{
return
MappableCacheLeafSetup
(
std
::
static_pointer_cast
<
DatasetOp
>
(
node
));
}
// Perform leaf node cache tran
form identifications
Status
CacheTransformPass
::
CachePass
::
RunOnNode
(
std
::
shared_ptr
<
Manifest
Op
>
node
,
bool
*
modified
)
{
// Perform leaf node cache tran
sform identification
Status
CacheTransformPass
::
CachePass
::
RunOnNode
(
std
::
shared_ptr
<
Coco
Op
>
node
,
bool
*
modified
)
{
return
MappableCacheLeafSetup
(
std
::
static_pointer_cast
<
DatasetOp
>
(
node
));
}
// Perform leaf node cache tran
form identifications
Status
CacheTransformPass
::
CachePass
::
RunOnNode
(
std
::
shared_ptr
<
C
ifar
Op
>
node
,
bool
*
modified
)
{
// Perform leaf node cache tran
sform identification
Status
CacheTransformPass
::
CachePass
::
RunOnNode
(
std
::
shared_ptr
<
C
elebA
Op
>
node
,
bool
*
modified
)
{
return
MappableCacheLeafSetup
(
std
::
static_pointer_cast
<
DatasetOp
>
(
node
));
}
// Perform leaf node cache tran
form identifications
Status
CacheTransformPass
::
CachePass
::
RunOnNode
(
std
::
shared_ptr
<
VOC
Op
>
node
,
bool
*
modified
)
{
// Perform leaf node cache tran
sform identification
Status
CacheTransformPass
::
CachePass
::
RunOnNode
(
std
::
shared_ptr
<
MindRecord
Op
>
node
,
bool
*
modified
)
{
return
MappableCacheLeafSetup
(
std
::
static_pointer_cast
<
DatasetOp
>
(
node
));
}
// Perform leaf node cache tranform identifications
Status
CacheTransformPass
::
CachePass
::
RunOnNode
(
std
::
shared_ptr
<
CocoOp
>
node
,
bool
*
modified
)
{
#ifdef ENABLE_PYTHON
// Perform leaf node cache transform identification
Status
CacheTransformPass
::
CachePass
::
RunOnNode
(
std
::
shared_ptr
<
GeneratorOp
>
node
,
bool
*
modified
)
{
return
MappableCacheLeafSetup
(
std
::
static_pointer_cast
<
DatasetOp
>
(
node
));
}
// Perform leaf node cache tran
form identifications
Status
CacheTransformPass
::
CachePass
::
RunOnNode
(
std
::
shared_ptr
<
CelebA
Op
>
node
,
bool
*
modified
)
{
// Perform leaf node cache tran
sform identification
Status
CacheTransformPass
::
CachePass
::
RunOnNode
(
std
::
shared_ptr
<
Manifest
Op
>
node
,
bool
*
modified
)
{
return
MappableCacheLeafSetup
(
std
::
static_pointer_cast
<
DatasetOp
>
(
node
));
}
// Perform leaf node cache tran
form identifications
Status
CacheTransformPass
::
CachePass
::
RunOnNode
(
std
::
shared_ptr
<
MindRecord
Op
>
node
,
bool
*
modified
)
{
// Perform leaf node cache tran
sform identification
Status
CacheTransformPass
::
CachePass
::
RunOnNode
(
std
::
shared_ptr
<
VOC
Op
>
node
,
bool
*
modified
)
{
return
MappableCacheLeafSetup
(
std
::
static_pointer_cast
<
DatasetOp
>
(
node
));
}
#endif
// Assigns the leaf and cache operators that are involved in a cache transformation
void
CacheTransformPass
::
CachePass
::
AddMappableCacheOperators
(
std
::
shared_ptr
<
DatasetOp
>
leaf_op
,
...
...
mindspore/ccsrc/minddata/dataset/engine/opt/pre/cache_transform_pass.h
浏览文件 @
b65125b0
...
...
@@ -82,6 +82,7 @@ class CacheTransformPass : public TreePass {
/// \return Status The error code return
Status
RunOnNode
(
std
::
shared_ptr
<
MnistOp
>
node
,
bool
*
modified
)
override
;
#ifdef ENABLE_PYTHON
/// \brief Perform leaf node cache tranform identifications
/// \param[in] node The node being visited
/// \param[inout] modified Indicator if the node was changed at all
...
...
@@ -98,13 +99,14 @@ class CacheTransformPass : public TreePass {
/// \param[in] node The node being visited
/// \param[inout] modified Indicator if the node was changed at all
/// \return Status The error code return
Status
RunOnNode
(
std
::
shared_ptr
<
CifarOp
>
node
,
bool
*
modified
)
override
;
Status
RunOnNode
(
std
::
shared_ptr
<
VOCOp
>
node
,
bool
*
modified
)
override
;
#endif
/// \brief Perform leaf node cache tranform identifications
/// \param[in] node The node being visited
/// \param[inout] modified Indicator if the node was changed at all
/// \return Status The error code return
Status
RunOnNode
(
std
::
shared_ptr
<
VOC
Op
>
node
,
bool
*
modified
)
override
;
Status
RunOnNode
(
std
::
shared_ptr
<
Cifar
Op
>
node
,
bool
*
modified
)
override
;
/// \brief Perform leaf node cache tranform identifications
/// \param[in] node The node being visited
...
...
mindspore/ccsrc/minddata/dataset/include/tensor.h
浏览文件 @
b65125b0
...
...
@@ -649,12 +649,13 @@ class Tensor {
unsigned
char
*
data_end_
=
nullptr
;
private:
#ifdef ENABLE_PYTHON
/// Helper function to create a tensor from Numpy array of strings
/// \param[in] arr Numpy array
/// \param[out] out Created Tensor
/// \return Status
static
Status
CreateFromNpString
(
py
::
array
arr
,
TensorPtr
*
out
);
#endif
/// Copy raw data of a array based on shape and strides to the destination pointer
/// \param dst [out] Pointer to the destination array where the content is to be copied
/// \param[in] src Pointer to the source of strided array to be copied
...
...
tests/ut/cpp/CMakeLists.txt
浏览文件 @
b65125b0
...
...
@@ -39,6 +39,7 @@ if(ENABLE_MINDDATA)
dataset/filter_op_test.cc
dataset/voc_op_test.cc
dataset/manifest_op_test.cc
dataset/sentence_piece_vocab_op_test.cc
)
list
(
REMOVE_ITEM UT_SRCS
${
PYTHON_RELATED_SRCS
}
)
endif
()
...
...
tests/ut/cpp/dataset/CMakeLists.txt
浏览文件 @
b65125b0
...
...
@@ -55,7 +55,7 @@ SET(DE_UT_SRCS
resize_bilinear_op_test.cc
resize_op_test.cc
resize_with_bbox_op_test.cc
schema_test.cc
schema_test.cc
shuffle_op_test.cc
stand_alone_samplers_test.cc
status_test.cc
...
...
@@ -71,15 +71,12 @@ SET(DE_UT_SRCS
subset_random_sampler_test.cc
weighted_random_sampler_test.cc
mnist_op_test.cc
manifest_op_test.cc
voc_op_test.cc
cifar_op_test.cc
celeba_op_test.cc
take_op_test.cc
clue_op_test.cc
csv_op_test.cc
text_file_op_test.cc
filter_op_test.cc
concat_op_test.cc
jieba_tokenizer_op_test.cc
tokenizer_op_test.cc
...
...
@@ -95,10 +92,19 @@ SET(DE_UT_SRCS
tensor_op_fusion_pass_test.cc
sliding_window_op_test.cc
epoch_ctrl_op_test.cc
sentence_piece_vocab_op_test.cc
swap_red_blue_test.cc
swap_red_blue_test.cc
)
if
(
ENABLE_PYTHON
)
set
(
DE_UT_SRCS
${
DE_UT_SRCS
}
filter_op_test.cc
manifest_op_test.cc
voc_op_test.cc
sentence_piece_vocab_op_test.cc
)
endif
()
add_executable
(
de_ut_tests
${
DE_UT_SRCS
}
)
set_target_properties
(
de_ut_tests PROPERTIES INSTALL_RPATH
"$ORIGIN/../lib:$ORIGIN/../lib64"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录