Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
04b1e4dc
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
1 年多 前同步成功
通知
696
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
04b1e4dc
编写于
8月 25, 2018
作者:
D
dzhwinter
提交者:
GitHub
8月 25, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tensor module windows support (#12934)
* tensor windows support * "fix ci" * "remove utils"
上级
77c0aeb9
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
30 addition
and
1 deletion
+30
-1
paddle/fluid/framework/lod_tensor.cc
paddle/fluid/framework/lod_tensor.cc
+16
-1
paddle/fluid/framework/lod_tensor_test.cc
paddle/fluid/framework/lod_tensor_test.cc
+2
-0
paddle/fluid/framework/rw_lock.h
paddle/fluid/framework/rw_lock.h
+12
-0
未找到文件。
paddle/fluid/framework/lod_tensor.cc
浏览文件 @
04b1e4dc
...
@@ -25,8 +25,10 @@ limitations under the License. */
...
@@ -25,8 +25,10 @@ limitations under the License. */
#include "paddle/fluid/memory/memcpy.h"
#include "paddle/fluid/memory/memcpy.h"
#include "paddle/fluid/memory/memory.h"
#include "paddle/fluid/memory/memory.h"
#if !defined(_WIN32)
#include "paddle/fluid/recordio/scanner.h"
#include "paddle/fluid/recordio/scanner.h"
#include "paddle/fluid/recordio/writer.h"
#include "paddle/fluid/recordio/writer.h"
#endif // _WIN32
namespace
paddle
{
namespace
paddle
{
namespace
framework
{
namespace
framework
{
...
@@ -300,6 +302,7 @@ void DeserializeFromStream(std::istream &is, LoDTensor *tensor,
...
@@ -300,6 +302,7 @@ void DeserializeFromStream(std::istream &is, LoDTensor *tensor,
TensorFromStream
(
is
,
static_cast
<
Tensor
*>
(
tensor
),
dev_ctx
);
TensorFromStream
(
is
,
static_cast
<
Tensor
*>
(
tensor
),
dev_ctx
);
}
}
#if !defined(_WIN32)
void
WriteToRecordIO
(
recordio
::
Writer
*
writer
,
void
WriteToRecordIO
(
recordio
::
Writer
*
writer
,
const
std
::
vector
<
LoDTensor
>
&
tensor
,
const
std
::
vector
<
LoDTensor
>
&
tensor
,
const
platform
::
DeviceContext
&
dev_ctx
)
{
const
platform
::
DeviceContext
&
dev_ctx
)
{
...
@@ -329,7 +332,19 @@ bool ReadFromRecordIO(recordio::Scanner *scanner,
...
@@ -329,7 +332,19 @@ bool ReadFromRecordIO(recordio::Scanner *scanner,
return
true
;
return
true
;
}
}
#else
class
Writer
{};
class
Scanner
{};
void
WriteToRecordIO
(
recordio
::
Writer
*
writer
,
const
std
::
vector
<
LoDTensor
>
&
tensor
,
const
platform
::
DeviceContext
&
dev_ctx
)
{}
bool
ReadFromRecordIO
(
recordio
::
Scanner
*
scanner
,
const
platform
::
DeviceContext
&
dev_ctx
,
std
::
vector
<
LoDTensor
>
*
result_ptr
)
{
PADDLE_ENFORCE
(
"windows didn't supported recordio!."
);
return
true
;
}
#endif // _WIN32
std
::
vector
<
LoDTensor
>
LoDTensor
::
SplitLoDTensor
(
std
::
vector
<
LoDTensor
>
LoDTensor
::
SplitLoDTensor
(
const
std
::
vector
<
platform
::
Place
>
places
)
const
{
const
std
::
vector
<
platform
::
Place
>
places
)
const
{
check_memory_size
();
check_memory_size
();
...
...
paddle/fluid/framework/lod_tensor_test.cc
浏览文件 @
04b1e4dc
...
@@ -274,6 +274,7 @@ TEST(LoD, ConvertToOffsetBasedLoD) {
...
@@ -274,6 +274,7 @@ TEST(LoD, ConvertToOffsetBasedLoD) {
EXPECT_EQ
(
offset_lod
,
expected
);
EXPECT_EQ
(
offset_lod
,
expected
);
}
}
#if !defined(_WIN32)
template
<
typename
T
>
template
<
typename
T
>
static
void
TestRecordIO
()
{
static
void
TestRecordIO
()
{
LoDTensor
tensor
;
LoDTensor
tensor
;
...
@@ -320,6 +321,7 @@ TEST(LoDTensor, RecordIO) {
...
@@ -320,6 +321,7 @@ TEST(LoDTensor, RecordIO) {
TestRecordIO
<
float
>
();
TestRecordIO
<
float
>
();
TestRecordIO
<
double
>
();
TestRecordIO
<
double
>
();
}
}
#endif // !defined(_WIN32)
}
// namespace framework
}
// namespace framework
}
// namespace paddle
}
// namespace paddle
paddle/fluid/framework/rw_lock.h
浏览文件 @
04b1e4dc
...
@@ -14,13 +14,16 @@ limitations under the License. */
...
@@ -14,13 +14,16 @@ limitations under the License. */
#pragma once
#pragma once
#if !defined(_WIN32)
#include <pthread.h>
#include <pthread.h>
#endif // !_WIN32
#include "paddle/fluid/platform/enforce.h"
#include "paddle/fluid/platform/enforce.h"
namespace
paddle
{
namespace
paddle
{
namespace
framework
{
namespace
framework
{
#if !defined(_WIN32)
struct
RWLock
{
struct
RWLock
{
RWLock
()
{
pthread_rwlock_init
(
&
lock_
,
nullptr
);
}
RWLock
()
{
pthread_rwlock_init
(
&
lock_
,
nullptr
);
}
...
@@ -43,6 +46,15 @@ struct RWLock {
...
@@ -43,6 +46,15 @@ struct RWLock {
private:
private:
pthread_rwlock_t
lock_
;
pthread_rwlock_t
lock_
;
};
};
#else
// https://stackoverflow.com/questions/7125250/making-pthread-rwlock-wrlock-recursive
// In windows, rw_lock seems like a hack. Use empty object and do nothing.
struct
RWLock
{
void
RDLock
()
{}
void
WRLock
()
{}
void
UNLock
()
{}
};
#endif
}
// namespace framework
}
// namespace framework
}
// namespace paddle
}
// namespace paddle
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录