-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathcommon.h
More file actions
36 lines (31 loc) · 1.04 KB
/
common.h
File metadata and controls
36 lines (31 loc) · 1.04 KB
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
#ifndef COMMON_H
#define COMMON_H
#include "backends/cpu/cpu_ops.h"
#include "backends/gpu/cuda/cuda_ops.h"
#include "backends/gpu/metal/metal_ops.h"
#include "graph/node.h"
extern BackendOps* g_backend_ops;
extern bool g_training;
void zero_grad();
void zero_c_tensors();
void print_no_zero_tensor_names();
void insert_boundary_action();
void init_backend();
void release_backend();
void construct_env();
void destruct_env();
void use_gpu(bool use = true);
bool is_use_gpu();
void print_all_tensors();
#define NUM_STEPS 9 // 对齐 dl2 dataloader
#define MAX_POSENCODING_LEN 1000 // 对齐 dl2
#define RESOURCE_NAME "./resources/fra_preprocessed_512.txt"
#define SRC_VOCAB_NAME "./vocab/fra_vocab_builder/vocab_en.txt"
#define TGT_VOCAB_NAME "./vocab/fra_vocab_builder/vocab_fr.txt"
#define TEST_FILE "./test.txt"
#define TEST_LM_FILE "./test_lm.txt"
#define LM_PREDICT_CNT 50
#define LM_NUM_STEPS 32
#define TIMEMACHINE_VOCAB_NAME "./vocab/time_machine/vocab.txt"
#define TIMEMACHINE_RESOURCE_NAME "./resources/time_machine/timemachine_preprocessed.txt"
#endif