MCPcopy Create free account
hub / github.com/clab/dynet / SoftmaxTest

Method SoftmaxTest

tests/test-softmax.cc:21–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19
20struct SoftmaxTest {
21 SoftmaxTest() {
22 // initialize if necessary
23 if (default_device == nullptr) {
24 for (auto x : {"SoftmaxTest", "--dynet-seed", "10", "--dynet-mem", "10"}) {
25 av.push_back(strdup(x));
26 }
27 ADD_EXTRA_ARGUMENTS(av)
28 char **argv = &av[0];
29 int argc = av.size();
30 dynet::initialize(argc, argv);
31 }
32 vec_values = {1.f, 2.f, 3.f};
33 batch_values = {1.f, 2.f, 3.f, 4.f, 5.f, 6.f};
34 ofstream ofs("cluster_file.txt");
35 for (unsigned i = 0; i < 5; ++i) {
36 for (unsigned j = 0; j < 2; ++j) {
37 stringstream ss;
38 ss << (i * 2 + j);
39 dic.convert(ss.str());
40 ofs << i << " " << ss.str() << endl;
41 }
42 }
43 ofs.close();
44 }
45 ~SoftmaxTest() {
46 // This was causing double deallocation errors?
47 // for (auto x : av) free(x);

Callers

nothing calls this directly

Calls 3

initializeFunction · 0.50
sizeMethod · 0.45
convertMethod · 0.45

Tested by

no test coverage detected