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

github.com/marian-nmt/marian.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcin Junczys-Dowmunt <junczys@amu.edu.pl>2016-05-04 01:12:21 +0300
committerMarcin Junczys-Dowmunt <junczys@amu.edu.pl>2016-05-04 01:12:21 +0300
commitc49242ec699053f55b57a1db41297aa44119cb95 (patch)
tree6448cfc7fd67ddde3e0d0358d8fc05b260c9dea3 /src
parent6a7c9316fcc0e752ff992a1770a430c4b9687b59 (diff)
in loop
Diffstat (limited to 'src')
-rwxr-xr-xsrc/a.outbin183120 -> 183343 bytes
-rw-r--r--src/mad.h6
-rw-r--r--src/test.cpp11
3 files changed, 11 insertions, 6 deletions
diff --git a/src/a.out b/src/a.out
index 765a2aa9..d848b3c9 100755
--- a/src/a.out
+++ b/src/a.out
Binary files differ
diff --git a/src/mad.h b/src/mad.h
index 0c4b079e..f55e7bee 100644
--- a/src/mad.h
+++ b/src/mad.h
@@ -9,9 +9,11 @@
namespace mad {
-typedef float Tensor;
+typedef float Tensor; // Now do this for cuDNN tensors!
+struct Chainable;
boost::pool<> p(sizeof(char));
+std::vector<Chainable*> stack;
struct Chainable {
Chainable() { }
@@ -26,8 +28,6 @@ struct Chainable {
}
};
-std::vector<Chainable*> stack;
-
class Vimpl : public Chainable {
public:
Vimpl(const Tensor& t) : val_{std::move(t)}, adj_{0} {
diff --git a/src/test.cpp b/src/test.cpp
index 6f29902c..95e88f89 100644
--- a/src/test.cpp
+++ b/src/test.cpp
@@ -1,4 +1,5 @@
#include <iostream>
+#include <ctime>
#include "mad.h"
@@ -6,13 +7,17 @@ int main(int argc, char** argv) {
using namespace mad;
{
+ srand(time(NULL));
+ size_t max = rand() % 20 + 1;
+
Var x0 = 1, x1 = 2, x2 = 3;
- auto y = x0 + x0 + log(x2) + x1;
+ Var y = 0.0;
+ for(int i = 0; i < max; i++)
+ y = y + x0 + log(x2) + x1;
std::vector<Var> x = { x0, x1, x2 };
-
-
+
set_zero_all_adjoints();
y.grad();