Welcome to mirror list, hosted at ThFree Co, Russian Federation.

expressions.h « src - github.com/marian-nmt/marian.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9044560390ee7eb4903dbaa16303696d0e7dbbcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once

#include "definitions.h"
#include "graph.h"

namespace marian {

class Expr {
  public:
    Expr(Chainable<Tensor>* chainable);
    Expr(Float v);
    
    Expr operator=(Tensor t) {
      pimpl_->setVal(t);
      return *this;
    }
    
    Tensor val();
    Tensor grad();
    
    void forward(size_t batchSize);
    void backward();
    
    ChainPtr node();
    operator ChainPtr();
    
  private:
    ChainPtr pimpl_; 
};

}