提交 05211610 编写于 作者: Y yangyaming

Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into fix-3923-r

...@@ -2,7 +2,7 @@ INCLUDE(ExternalProject) ...@@ -2,7 +2,7 @@ INCLUDE(ExternalProject)
SET(NCCL_SOURCE_DIR ${THIRD_PARTY_PATH}/nccl) SET(NCCL_SOURCE_DIR ${THIRD_PARTY_PATH}/nccl)
INCLUDE_DIRECTORIES(${NCCL_SOURCE_DIR}/src/extern_nccl) INCLUDE_DIRECTORIES(${NCCL_SOURCE_DIR}/src/extern_nccl/src)
if(WITH_DSO) if(WITH_DSO)
......
...@@ -75,7 +75,8 @@ class Im2ColFunctor { ...@@ -75,7 +75,8 @@ class Im2ColFunctor {
void operator()(const platform::DeviceContext& context, void operator()(const platform::DeviceContext& context,
const framework::Tensor& im, framework::Tensor& col, const framework::Tensor& im, framework::Tensor& col,
int stride_height, int stride_width, int padding_up, int stride_height, int stride_width, int padding_up,
int padding_down, int padding_left, int padding_right); int padding_down, int padding_left = 0,
int padding_right = 0);
}; };
template <ColFormat Format, typename Place, typename T> template <ColFormat Format, typename Place, typename T>
...@@ -84,7 +85,7 @@ class Col2ImFunctor { ...@@ -84,7 +85,7 @@ class Col2ImFunctor {
void operator()(const platform::DeviceContext& context, framework::Tensor& im, void operator()(const platform::DeviceContext& context, framework::Tensor& im,
const framework::Tensor& col, int stride_height, const framework::Tensor& col, int stride_height,
int stride_width, int padding_up, int padding_down, int stride_width, int padding_up, int padding_down,
int padding_left, int padding_right); int padding_left = 0, int padding_right = 0);
}; };
} // namespace math } // namespace math
......
...@@ -326,6 +326,17 @@ class Parameters(object): ...@@ -326,6 +326,17 @@ class Parameters(object):
self.set(name, arr.reshape(self.get_shape(name))) self.set(name, arr.reshape(self.get_shape(name)))
def to_tar(self, f): def to_tar(self, f):
"""
Save parameters to a tar file.
WARNING: You should use `paddle.v2.trainer.SGD.save_parameter_to_tar(f)`
to save parameters most of the time. Otherwise, some settings such
as model average will not take effect.
:param f:
:type f: file
:return:
"""
tar = tarfile.TarFile(fileobj=f, mode='w') tar = tarfile.TarFile(fileobj=f, mode='w')
for nm in self.names(): for nm in self.names():
buf = cStringIO.StringIO() buf = cStringIO.StringIO()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册