forked from arrayfire/arrayfire
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiota.cpp
More file actions
47 lines (37 loc) · 1.11 KB
/
iota.cpp
File metadata and controls
47 lines (37 loc) · 1.11 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 <iota.hpp>
#include <kernel/iota.hpp>
#include <Array.hpp>
#include <common/half.hpp>
#include <math.hpp>
#include <platform.hpp>
#include <queue.hpp>
using common::half; // NOLINT(misc-unused-using-decls) bug in clang-tidy
namespace cpu {
template<typename T>
Array<T> iota(const dim4 &dims, const dim4 &tile_dims) {
dim4 outdims = dims * tile_dims;
Array<T> out = createEmptyArray<T>(outdims);
getQueue().enqueue(kernel::iota<T>, out, dims);
return out;
}
#define INSTANTIATE(T) \
template Array<T> iota<T>(const af::dim4 &dims, const af::dim4 &tile_dims);
INSTANTIATE(float)
INSTANTIATE(double)
INSTANTIATE(int)
INSTANTIATE(uint)
INSTANTIATE(intl)
INSTANTIATE(uintl)
INSTANTIATE(uchar)
INSTANTIATE(short)
INSTANTIATE(ushort)
INSTANTIATE(half)
} // namespace cpu