Merge branch 'master' of github.com:emjotde/marian

This commit is contained in:
Marcin Junczys-Dowmunt 2016-09-22 18:35:53 +02:00
commit 162c0b5896
4 changed files with 6 additions and 12 deletions

View File

@ -114,14 +114,6 @@ float Node::L2Norm(const std::vector<float> &vec) const
return sqrt(ret);
}
std::vector<float> Node::StoreTensorInVec(Tensor tensor)
{
size_t totSize = GetTotalSize(tensor.shape());
std::vector<float> vec(totSize);
thrust::copy(tensor.begin(), tensor.end(), vec.begin());
return vec;
}
void Node::broadcast(const std::vector<float> &largeVec, std::vector<float> &smallVec)
{
size_t largeSize = largeVec.size();

View File

@ -122,7 +122,6 @@ class Node : public Chainable<Tensor>,
std::cerr << std::endl;
}
std::vector<float> StoreTensorInVec(Tensor tensor);
void calc_numeric_grad(
Float delta,
Tensor input,

View File

@ -17,10 +17,12 @@ struct BinaryNodeOp : public Node {
cerr << "BinaryNodeOp::" << typeid(*this).name() << "::backward_debug()" << endl;
std::vector<float> preCalcGradA = StoreTensorInVec(a_->grad());
std::vector<float> preCalcGradA;
preCalcGradA << a_->grad();
//output("preCalcGradA", preCalcGradA);
std::vector<float> preCalcGradB = StoreTensorInVec(b_->grad());
std::vector<float> preCalcGradB;
preCalcGradB << b_->grad();
//output("preCalcGradB", preCalcGradB);
// use df/dx to calc grad

View File

@ -16,7 +16,8 @@ struct UnaryNodeOp : public Node {
cerr << "UnaryNodeOp::" << typeid(*this).name() << "::backward_numeric()" << endl;
std::vector<float> preCalcGradA = StoreTensorInVec(a_->grad());
std::vector<float> preCalcGradA;
preCalcGradA << a_->grad();
//output("preCalcGradA", preCalcGradA);
// use df/dx to calc grad