"tests/synced_batchnorm/test_groups.py" did not exist on "1b903852aecd388e10f03e470fcb1993f1c871dd"
utils.h 914 Bytes
Newer Older
rusty1s's avatar
rusty1s committed
1
2
3
4
5
6
#pragma once

#include <torch/extension.h>

#define CHECK_CPU(x) AT_ASSERTM(x.device().is_cpu(), #x " must be CPU tensor")
#define CHECK_INPUT(x) AT_ASSERTM(x, "Input mismatch")
rusty1s's avatar
matmul  
rusty1s committed
7
8
9

#define AT_DISPATCH_HAS_VALUE(optional_value, ...)                             \
  [&] {                                                                        \
10
    if (optional_value.has_value()) {                                          \
rusty1s's avatar
matmul  
rusty1s committed
11
12
      const bool HAS_VALUE = true;                                             \
      return __VA_ARGS__();                                                    \
13
    } else {                                                                   \
rusty1s's avatar
matmul  
rusty1s committed
14
15
16
17
      const bool HAS_VALUE = false;                                            \
      return __VA_ARGS__();                                                    \
    }                                                                          \
  }()