-
Notifications
You must be signed in to change notification settings - Fork 548
Expand file tree
/
Copy pathidentity.cpp
More file actions
47 lines (41 loc) · 1.21 KB
/
identity.cpp
File metadata and controls
47 lines (41 loc) · 1.21 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
37
38
39
40
41
42
43
44
45
46
47
/*******************************************************
* Copyright (c) 2014, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
#include <identity.hpp>
#include <kernel/identity.hpp>
#include <Array.hpp>
#include <common/half.hpp>
#include <debug_cuda.hpp>
#include <af/dim4.hpp>
using arrayfire::common::half;
namespace arrayfire {
namespace cuda {
template<typename T>
Array<T> identity(const dim4& dims) {
Array<T> out = createEmptyArray<T>(dims);
kernel::identity<T>(out);
return out;
}
#define INSTANTIATE_IDENTITY(T) \
template Array<T> identity<T>(const af::dim4& dims);
INSTANTIATE_IDENTITY(float)
INSTANTIATE_IDENTITY(double)
INSTANTIATE_IDENTITY(cfloat)
INSTANTIATE_IDENTITY(cdouble)
INSTANTIATE_IDENTITY(int)
INSTANTIATE_IDENTITY(uint)
INSTANTIATE_IDENTITY(intl)
INSTANTIATE_IDENTITY(uintl)
INSTANTIATE_IDENTITY(char)
INSTANTIATE_IDENTITY(schar)
INSTANTIATE_IDENTITY(uchar)
INSTANTIATE_IDENTITY(short)
INSTANTIATE_IDENTITY(ushort)
INSTANTIATE_IDENTITY(half)
} // namespace cuda
} // namespace arrayfire