summaryrefslogtreecommitdiffstats
path: root/contrib/lua-torch/nn/lib/THNN/THNN.h
blob: 0019b7976c387cd888e646818d3032953ca7bd0b (plain)
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
#ifndef THNN_H
#define THNN_H

#include <stdbool.h>
#include <TH.h>
#ifdef _OPENMP
#include <omp.h>
#endif

#define THNN_(NAME) TH_CONCAT_3(THNN_, Real, NAME)

#define THIndexTensor THLongTensor
#define THIndexTensor_(NAME) THLongTensor_ ## NAME

#define THIntegerTensor THIntTensor
#define THIntegerTensor_(NAME) THIntTensor_ ## NAME

typedef long THIndex_t;
typedef int THInteger_t;
typedef void THNNState;

#define THNN_resizeAs_indices(I1, I2)                    \
  THLongStorage *size2 = THIndexTensor_(newSizeOf)(I2);  \
  if (!THTensor_(isSize)(I1, size2))                     \
  { \
    THTensor_(resize)(I1, size2, NULL);                  \
  } \
  THLongStorage_free(size2);

#include "generic/THNN.h"
#include <THGenerateFloatTypes.h>

#endif