debug.h 401 Bytes
Newer Older
Zhekai Zhang's avatar
Zhekai Zhang committed
1
2
3
4
5
6
7
8
9
10
11
#pragma once

#include "common.h"
#include "Tensor.h"

class DebugContext {
public:
    DebugContext() {
        ctxs.insert(this);
    }
    DebugContext(const DebugContext &) = delete;
Muyang Li's avatar
Muyang Li committed
12
13
    DebugContext(DebugContext &&)      = delete;

Zhekai Zhang's avatar
Zhekai Zhang committed
14
15
16
17
18
19
20
21
    ~DebugContext() {
        ctxs.erase(this);
    }

    std::map<std::string, Tensor> tensors;

    static inline thread_local std::set<DebugContext *> ctxs;
};