提交 94e38bb5 编写于 作者: Y Yu Yang

Merge branch 'develop' of github.com:baidu/Paddle into memory.set_input

...@@ -72,7 +72,7 @@ function( Sphinx_add_target target_name builder conf cache source destination ) ...@@ -72,7 +72,7 @@ function( Sphinx_add_target target_name builder conf cache source destination )
${source} ${source}
${destination} ${destination}
COMMENT "Generating sphinx documentation: ${builder}" COMMENT "Generating sphinx documentation: ${builder}"
COMMAND cd ${destination} && ln -s ./index_*.html index.html COMMAND cd ${destination} && ln -sf ./index_*.html index.html
) )
set_property( set_property(
......
...@@ -56,17 +56,16 @@ void SequencePoolLayer::forward(PassType passType) { ...@@ -56,17 +56,16 @@ void SequencePoolLayer::forward(PassType passType) {
CHECK_EQ(newBatchSize_, starts->getSize() - 1); CHECK_EQ(newBatchSize_, starts->getSize() - 1);
resetOutput(newBatchSize_, dim); resetOutput(newBatchSize_, dim);
if (type_) {
CHECK(input.subSequenceStartPositions)
<< "when trans_type = seq, input must hasSubseq";
}
/* If type_ = kNonSeq, both seq has or not has sub-seq degrade to a non-seq, /* If type_ = kNonSeq, both seq has or not has sub-seq degrade to a non-seq,
* thus, in this case, output_ has no sequenceStartPositions. * thus, in this case, output_ has no sequenceStartPositions.
* If type_ = kSeq, seq has sub-seq degrades to a seq, thus, only in this * If type_ = kSeq, seq has sub-seq degrades to a seq, thus, only in this
* case, we should compute the new sequenceStartPositions. * case, we should compute the new sequenceStartPositions.
*/ */
if (type_) { if (type_) {
output_.degradeSequence(input, useGpu_); CHECK(input.subSequenceStartPositions)
<< "when trans_type = seq, input must hasSubseq";
output_.degradeSequence(input);
} }
} }
......
...@@ -583,7 +583,7 @@ void Argument::checkSubset() const { ...@@ -583,7 +583,7 @@ void Argument::checkSubset() const {
} }
} }
void Argument::degradeSequence(const Argument& input, bool useGpu) { void Argument::degradeSequence(const Argument& input) {
CHECK_EQ(input.hasSubseq(), 1UL); CHECK_EQ(input.hasSubseq(), 1UL);
size_t numSequences = input.getNumSequences(); size_t numSequences = input.getNumSequences();
size_t numSubSequences = input.getNumSubSequences(); size_t numSubSequences = input.getNumSubSequences();
......
...@@ -296,7 +296,7 @@ struct Argument { ...@@ -296,7 +296,7 @@ struct Argument {
/* /*
sequence has sub-sequence degrades to a sequence. sequence has sub-sequence degrades to a sequence.
*/ */
void degradeSequence(const Argument& input, bool useGpu); void degradeSequence(const Argument& input);
/** /**
* @brief getValueString will return the argument's output in string. There * @brief getValueString will return the argument's output in string. There
......
...@@ -23,7 +23,7 @@ __all__ = ['train', 'test', 'build_dict'] ...@@ -23,7 +23,7 @@ __all__ = ['train', 'test', 'build_dict']
URL_DEV_TEST = 'http://www-lium.univ-lemans.fr/~schwenk/cslm_joint_paper/data/dev+test.tgz' URL_DEV_TEST = 'http://www-lium.univ-lemans.fr/~schwenk/cslm_joint_paper/data/dev+test.tgz'
MD5_DEV_TEST = '7d7897317ddd8ba0ae5c5fa7248d3ff5' MD5_DEV_TEST = '7d7897317ddd8ba0ae5c5fa7248d3ff5'
# this is a small set of data for test. The original data is too large and will be add later. # this is a small set of data for test. The original data is too large and will be add later.
URL_TRAIN = 'http://paddlepaddle.bj.bcebos.com/demo/wmt_shrinked_data/wmt14.tgz' URL_TRAIN = 'http://paddlepaddle.cdn.bcebos.com/demo/wmt_shrinked_data/wmt14.tgz'
MD5_TRAIN = 'a755315dd01c2c35bde29a744ede23a6' MD5_TRAIN = 'a755315dd01c2c35bde29a744ede23a6'
START = "<s>" START = "<s>"
......
...@@ -22,7 +22,9 @@ import paddle.v2.networks as networks ...@@ -22,7 +22,9 @@ import paddle.v2.networks as networks
pixel = layer.data(name='pixel', type=data_type.dense_vector(128)) pixel = layer.data(name='pixel', type=data_type.dense_vector(128))
label = layer.data(name='label', type=data_type.integer_value(10)) label = layer.data(name='label', type=data_type.integer_value(10))
weight = layer.data(name='weight', type=data_type.dense_vector(10)) weight = layer.data(name='weight', type=data_type.dense_vector(1))
combine_weight = layer.data(
name='weight_combine', type=data_type.dense_vector(10))
score = layer.data(name='score', type=data_type.dense_vector(1)) score = layer.data(name='score', type=data_type.dense_vector(1))
hidden = layer.fc(input=pixel, hidden = layer.fc(input=pixel,
...@@ -81,7 +83,8 @@ class AggregateLayerTest(unittest.TestCase): ...@@ -81,7 +83,8 @@ class AggregateLayerTest(unittest.TestCase):
class MathLayerTest(unittest.TestCase): class MathLayerTest(unittest.TestCase):
def test_math_layer(self): def test_math_layer(self):
addto = layer.addto(input=[pixel, pixel]) addto = layer.addto(input=[pixel, pixel])
linear_comb = layer.linear_comb(weights=weight, vectors=hidden, size=10) linear_comb = layer.linear_comb(
weights=combine_weight, vectors=hidden, size=10)
interpolation = layer.interpolation( interpolation = layer.interpolation(
input=[hidden, hidden], weight=score) input=[hidden, hidden], weight=score)
bilinear = layer.bilinear_interp(input=conv, out_size_x=4, out_size_y=4) bilinear = layer.bilinear_interp(input=conv, out_size_x=4, out_size_y=4)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册