Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
227e09b2
P
Paddle
项目概览
PaddlePaddle
/
Paddle
接近 2 年 前同步成功
通知
2322
Star
20933
Fork
5424
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
227e09b2
编写于
8月 10, 2017
作者:
Y
Yu Yang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of github.com:baidu/Paddle into feature/fix_random_op_link_error
上级
45911102
0202e76f
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
59 addition
and
17 deletion
+59
-17
CMakeLists.txt
CMakeLists.txt
+2
-2
paddle/framework/attribute.h
paddle/framework/attribute.h
+1
-1
paddle/framework/ddim.h
paddle/framework/ddim.h
+1
-1
paddle/framework/operator.h
paddle/framework/operator.h
+1
-1
paddle/framework/tensor.h
paddle/framework/tensor.h
+2
-2
paddle/framework/tensor_impl.h
paddle/framework/tensor_impl.h
+11
-5
paddle/gserver/tests/test_KmaxSeqScore.cpp
paddle/gserver/tests/test_KmaxSeqScore.cpp
+6
-1
paddle/operators/gaussian_random_op.cu
paddle/operators/gaussian_random_op.cu
+1
-1
paddle/platform/place.h
paddle/platform/place.h
+1
-1
paddle/platform/variant.h
paddle/platform/variant.h
+32
-0
python/paddle/v2/framework/tests/CMakeLists.txt
python/paddle/v2/framework/tests/CMakeLists.txt
+1
-2
未找到文件。
CMakeLists.txt
浏览文件 @
227e09b2
...
@@ -36,8 +36,8 @@ include(simd)
...
@@ -36,8 +36,8 @@ include(simd)
################################ Configurations #######################################
################################ Configurations #######################################
option
(
WITH_GPU
"Compile PaddlePaddle with NVIDIA GPU"
${
CUDA_FOUND
}
)
option
(
WITH_GPU
"Compile PaddlePaddle with NVIDIA GPU"
${
CUDA_FOUND
}
)
option
(
WITH_AVX
"Compile PaddlePaddle with AVX intrinsics"
${
AVX_FOUND
}
)
option
(
WITH_AVX
"Compile PaddlePaddle with AVX intrinsics"
${
AVX_FOUND
}
)
option
(
WITH_MKLDNN
"Compile PaddlePaddle with mkl-dnn support."
${
AVX_FOUND
}
)
option
(
WITH_MKLDNN
"Compile PaddlePaddle with mkl-dnn support."
OFF
)
option
(
WITH_MKLML
"Compile PaddlePaddle with mklml package."
${
AVX_FOUND
}
)
option
(
WITH_MKLML
"Compile PaddlePaddle with mklml package."
OFF
)
option
(
WITH_DSO
"Compile PaddlePaddle with dynamic linked CUDA"
ON
)
option
(
WITH_DSO
"Compile PaddlePaddle with dynamic linked CUDA"
ON
)
option
(
WITH_TESTING
"Compile PaddlePaddle with unit testing"
ON
)
option
(
WITH_TESTING
"Compile PaddlePaddle with unit testing"
ON
)
option
(
WITH_SWIG_PY
"Compile PaddlePaddle with inference api"
ON
)
option
(
WITH_SWIG_PY
"Compile PaddlePaddle with inference api"
ON
)
...
...
paddle/framework/attribute.h
浏览文件 @
227e09b2
...
@@ -14,7 +14,6 @@ limitations under the License. */
...
@@ -14,7 +14,6 @@ limitations under the License. */
#pragma once
#pragma once
#include <boost/variant.hpp>
#include <functional>
#include <functional>
#include <string>
#include <string>
#include <unordered_map>
#include <unordered_map>
...
@@ -24,6 +23,7 @@ limitations under the License. */
...
@@ -24,6 +23,7 @@ limitations under the License. */
#include "paddle/framework/attribute.pb.h"
#include "paddle/framework/attribute.pb.h"
#include "paddle/framework/op_desc.pb.h"
#include "paddle/framework/op_desc.pb.h"
#include "paddle/platform/enforce.h"
#include "paddle/platform/enforce.h"
#include "paddle/platform/variant.h"
namespace
paddle
{
namespace
paddle
{
namespace
framework
{
namespace
framework
{
...
...
paddle/framework/ddim.h
浏览文件 @
227e09b2
...
@@ -14,12 +14,12 @@ limitations under the License. */
...
@@ -14,12 +14,12 @@ limitations under the License. */
#pragma once
#pragma once
#include <boost/variant.hpp>
#include <initializer_list>
#include <initializer_list>
#include <stdexcept>
#include <stdexcept>
#include <vector>
#include <vector>
#include "paddle/framework/dim.h"
#include "paddle/framework/dim.h"
#include "paddle/platform/enforce.h"
#include "paddle/platform/enforce.h"
#include "paddle/platform/variant.h"
#include "unsupported/Eigen/CXX11/Tensor"
#include "unsupported/Eigen/CXX11/Tensor"
namespace
paddle
{
namespace
paddle
{
...
...
paddle/framework/operator.h
浏览文件 @
227e09b2
...
@@ -15,7 +15,6 @@ limitations under the License. */
...
@@ -15,7 +15,6 @@ limitations under the License. */
#pragma once
#pragma once
#include <algorithm>
#include <algorithm>
#include <boost/variant.hpp>
#include <string>
#include <string>
#include <unordered_map>
#include <unordered_map>
#include <vector>
#include <vector>
...
@@ -27,6 +26,7 @@ limitations under the License. */
...
@@ -27,6 +26,7 @@ limitations under the License. */
#include "paddle/framework/tensor.h"
#include "paddle/framework/tensor.h"
#include "paddle/platform/device_context.h"
#include "paddle/platform/device_context.h"
#include "paddle/platform/place.h"
#include "paddle/platform/place.h"
#include "paddle/platform/variant.h"
#include "paddle/utils/Error.h"
#include "paddle/utils/Error.h"
namespace
paddle
{
namespace
paddle
{
...
...
paddle/framework/tensor.h
浏览文件 @
227e09b2
...
@@ -79,11 +79,11 @@ class Tensor {
...
@@ -79,11 +79,11 @@ class Tensor {
inline
const
DDim
&
dims
()
const
;
inline
const
DDim
&
dims
()
const
;
/*! Resize the dimensions of the memory block. */
/*! Resize the dimensions of the memory block. */
inline
void
Resize
(
const
DDim
&
dims
);
inline
Tensor
&
Resize
(
const
DDim
&
dims
);
/*! The internal of two tensors share the same memory block. */
/*! The internal of two tensors share the same memory block. */
template
<
typename
T
>
template
<
typename
T
>
inline
void
ShareDataWith
(
const
Tensor
&
src
);
inline
Tensor
&
ShareDataWith
(
const
Tensor
&
src
);
/**
/**
* @brief Copy the content of external tensor to a new place.
* @brief Copy the content of external tensor to a new place.
...
...
paddle/framework/tensor_impl.h
浏览文件 @
227e09b2
...
@@ -23,9 +23,11 @@ template <typename T>
...
@@ -23,9 +23,11 @@ template <typename T>
inline
void
Tensor
::
check_memory_size
()
const
{
inline
void
Tensor
::
check_memory_size
()
const
{
PADDLE_ENFORCE_NOT_NULL
(
PADDLE_ENFORCE_NOT_NULL
(
holder_
,
"Tenosr holds no memory. Call Tensor::mutable_data first."
);
holder_
,
"Tenosr holds no memory. Call Tensor::mutable_data first."
);
PADDLE_ENFORCE_GE
(
holder_
->
size
(),
product
(
dims_
)
*
sizeof
(
T
)
+
offset_
,
PADDLE_ENFORCE_GE
(
"Tensor's dims_ is out of bound. Call Tensor::mutable_data "
holder_
->
size
(),
product
(
dims_
)
*
sizeof
(
T
)
+
offset_
,
"first to re-allocate memory."
);
"Tensor's dims_ is out of bound. Call Tensor::mutable_data "
"first to re-allocate memory.
\n
"
"or maybe the required data-type mismatches the data already stored."
);
}
}
template
<
typename
T
>
template
<
typename
T
>
...
@@ -78,9 +80,10 @@ inline T* Tensor::mutable_data(platform::Place place) {
...
@@ -78,9 +80,10 @@ inline T* Tensor::mutable_data(platform::Place place) {
}
}
template
<
typename
T
>
template
<
typename
T
>
inline
void
Tensor
::
ShareDataWith
(
const
Tensor
&
src
)
{
inline
Tensor
&
Tensor
::
ShareDataWith
(
const
Tensor
&
src
)
{
src
.
check_memory_size
<
T
>
();
src
.
check_memory_size
<
T
>
();
*
this
=
src
;
*
this
=
src
;
return
*
this
;
}
}
template
<
typename
T
>
template
<
typename
T
>
...
@@ -136,7 +139,10 @@ inline Tensor Tensor::Slice(const int& begin_idx, const int& end_idx) const {
...
@@ -136,7 +139,10 @@ inline Tensor Tensor::Slice(const int& begin_idx, const int& end_idx) const {
return
dst
;
return
dst
;
}
}
inline
void
Tensor
::
Resize
(
const
DDim
&
dims
)
{
dims_
=
dims
;
}
inline
Tensor
&
Tensor
::
Resize
(
const
DDim
&
dims
)
{
dims_
=
dims
;
return
*
this
;
}
inline
const
DDim
&
Tensor
::
dims
()
const
{
return
dims_
;
}
inline
const
DDim
&
Tensor
::
dims
()
const
{
return
dims_
;
}
...
...
paddle/gserver/tests/test_KmaxSeqScore.cpp
浏览文件 @
227e09b2
...
@@ -96,6 +96,11 @@ TEST(Layer, kmaxSeqScoreLayer) {
...
@@ -96,6 +96,11 @@ TEST(Layer, kmaxSeqScoreLayer) {
MatrixPtr
inValue
=
MatrixPtr
inValue
=
Matrix
::
create
(
subSeqStartPosition
.
back
(),
1
,
false
,
false
);
Matrix
::
create
(
subSeqStartPosition
.
back
(),
1
,
false
,
false
);
std
::
vector
<
bool
>
mode
=
{
false
};
#ifndef PADDLE_ONLY_CPU
mode
.
push_back
(
true
);
#endif
for
(
auto
hasSubseq
:
{
false
,
true
})
{
for
(
auto
hasSubseq
:
{
false
,
true
})
{
vector
<
vector
<
int
>>
groundTruth
;
vector
<
vector
<
int
>>
groundTruth
;
inValue
->
randomizeUniform
();
inValue
->
randomizeUniform
();
...
@@ -104,7 +109,7 @@ TEST(Layer, kmaxSeqScoreLayer) {
...
@@ -104,7 +109,7 @@ TEST(Layer, kmaxSeqScoreLayer) {
hasSubseq
?
subSeqStartPosition
:
seqStartPosition
,
hasSubseq
?
subSeqStartPosition
:
seqStartPosition
,
beamSize
);
beamSize
);
for
(
auto
useGpu
:
{
false
,
true
}
)
{
for
(
auto
useGpu
:
mode
)
{
TestConfig
config
;
TestConfig
config
;
config
.
layerConfig
.
set_type
(
"kmax_seq_score"
);
config
.
layerConfig
.
set_type
(
"kmax_seq_score"
);
config
.
layerConfig
.
set_beam_size
(
beamSize
);
config
.
layerConfig
.
set_beam_size
(
beamSize
);
...
...
paddle/operators/gaussian_random_op.cu
浏览文件 @
227e09b2
...
@@ -49,4 +49,4 @@ class GaussianRandomKernel : public framework::OpKernel {
...
@@ -49,4 +49,4 @@ class GaussianRandomKernel : public framework::OpKernel {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP_GPU_KERNEL
(
gaussian_random
,
ops
::
GaussianRandomKernel
<
float
>
);
REGISTER_OP_GPU_KERNEL
(
gaussian_random
,
ops
::
GaussianRandomKernel
<
float
>
);
\ No newline at end of file
paddle/platform/place.h
浏览文件 @
227e09b2
...
@@ -14,8 +14,8 @@ limitations under the License. */
...
@@ -14,8 +14,8 @@ limitations under the License. */
#pragma once
#pragma once
#include <boost/variant.hpp>
#include <iostream>
#include <iostream>
#include "paddle/platform/variant.h"
namespace
paddle
{
namespace
paddle
{
namespace
platform
{
namespace
platform
{
...
...
paddle/platform/variant.h
0 → 100644
浏览文件 @
227e09b2
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#pragma once
#include <boost/config.hpp>
#ifndef PADDLE_ONLY_CPU
// Because boost's variadic templates has bug on nvcc, boost will disable
// variadic template support when GPU enabled on nvcc.
// Define BOOST_NO_CXX11_VARIADIC_TEMPLATES on gcc/clang to generate same
// function symbols.
//
// https://github.com/PaddlePaddle/Paddle/issues/3386
#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES
#define BOOST_NO_CXX11_VARIADIC_TEMPLATES
#endif
#endif
#include <boost/variant.hpp>
python/paddle/v2/framework/tests/CMakeLists.txt
浏览文件 @
227e09b2
...
@@ -23,6 +23,5 @@ py_test(test_rowwise_add_op SRCS test_rowwise_add_op.py)
...
@@ -23,6 +23,5 @@ py_test(test_rowwise_add_op SRCS test_rowwise_add_op.py)
py_test
(
test_default_scope_funcs SRCS test_default_scope_funcs.py
)
py_test
(
test_default_scope_funcs SRCS test_default_scope_funcs.py
)
py_test
(
test_operator SRCS test_operator.py
)
py_test
(
test_operator SRCS test_operator.py
)
# py_test(test_gaussian_random_op SRCS test_gaussian_random_op.py)
py_test
(
test_gaussian_random_op SRCS test_gaussian_random_op.py
)
py_test
(
test_uniform_random_op SRCS test_uniform_random_op.py
)
py_test
(
test_uniform_random_op SRCS test_uniform_random_op.py
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录