-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.cpp
48 lines (41 loc) · 1.18 KB
/
test.cpp
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <glog/logging.h>
#include <iostream>
#include "tensor.hpp"
Tensor myTest() {
Tensor result;
LOG(INFO) << "In myTest result address : " << &result;
return result;
}
Tensor wowTest(const Tensor& input) {
LOG(INFO) << "enter wowTest()";
Tensor result(input);
LOG(INFO) << "return wowTest()";
return result;
}
void test1() {
std::vector<float> test{1};
/* Tensor myTest; */
Tensor another;
Tensor abc(test, {1}, DataType::DT_FP32);
another = abc;
Tensor the_other = another;
Tensor all_other = abc;
LOG(INFO) << "Address of another : " << std::hex << &another;
LOG(INFO) << "Address of abc : " << std::hex << &abc;
LOG(INFO) << "Address of the_other : " << std::hex << &the_other;
LOG(INFO) << "Address of all_other : " << std::hex << &all_other;
Tensor rvo_test = myTest();
LOG(INFO) << "Address of rvo_test : " << std::hex << &rvo_test;
}
void test2() {
std::vector<float> test{1};
Tensor hello = Tensor(test, {1}, DataType::DT_FP32);
}
void test3() {
std::vector<float> test{1};
Tensor all_i_need_to_love(test, {1}, DataType::DT_FP32);
all_i_need_to_love = wowTest(all_i_need_to_love);
}
int main(int argc, char** argv) {
test3();
}