rexlib
0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
rexlib
ops
rules
shape_rules.hpp
1
// SPDX-License-Identifier: GPL-3.0-only
2
3
#pragma once
4
5
#include <rexlib/ops/rules/axes_of.hpp>
6
#include <rexlib/ops/rules/axis_half_spectrum_of.hpp>
7
#include <rexlib/ops/rules/count_of.hpp>
8
#include <rexlib/ops/rules/extent_of.hpp>
9
#include <rexlib/ops/rules/keep_dimensions_of.hpp>
10
11
#include <rexlib/core/meta/type_list.hpp>
12
#include <rexlib/core/operation/shape_rule/axis_run.hpp>
13
#include <rexlib/core/operation/shape_rule/core_dimensions.hpp>
14
#include <rexlib/core/operation/shape_rule/extent_pivot.hpp>
15
#include <rexlib/core/operation/shape_rule/extent_slot.hpp>
16
#include <rexlib/core/operation/shape_rule/named_core.hpp>
17
#include <rexlib/core/operation/shape_rule/operand_shape_rule.hpp>
18
#include <rexlib/core/operation/shape_rule/output_batch.hpp>
19
#include <rexlib/core/operation/shape_rule/positive_extent_domain.hpp>
20
#include <rexlib/core/operation/shape_rule/trailing_core.hpp>
21
22
namespace
rexlib
23
{
24
namespace
ops
25
{
26
45
using
nullary_elementwise_shape_rule
=
operand_shape_rule
<
46
type_list<>
,
47
type_list<core_dimensions<>
>,
48
type_list<>
,
49
trailing_core
,
50
output_batch::broadcast_target
51
>;
52
56
using
unary_elementwise_shape_rule
=
operand_shape_rule
<
57
type_list<>
,
58
type_list<core_dimensions<>
>,
59
type_list<core_dimensions<>
>,
60
trailing_core
,
61
output_batch::broadcast_target
62
>;
63
68
using
binary_elementwise_shape_rule
=
operand_shape_rule
<
69
type_list<>
,
70
type_list<core_dimensions<>
>,
71
type_list<core_dimensions<>
,
core_dimensions<>
>,
72
trailing_core
,
73
output_batch::broadcast_target
74
>;
75
80
using
ternary_elementwise_shape_rule
=
operand_shape_rule
<
81
type_list<>
,
82
type_list<core_dimensions<>
>,
83
type_list<core_dimensions<>
,
core_dimensions<>
,
core_dimensions<>
>,
84
trailing_core
,
85
output_batch::broadcast_target
86
>;
87
92
using
unary_pair_elementwise_shape_rule
=
operand_shape_rule
<
93
type_list<>
,
94
type_list<core_dimensions<>
,
core_dimensions<>
>,
95
type_list<core_dimensions<>
>,
96
trailing_core
,
97
output_batch::broadcast_target
98
>;
99
104
using
binary_pair_elementwise_shape_rule
=
operand_shape_rule
<
105
type_list<>
,
106
type_list<core_dimensions<>
,
core_dimensions<>
>,
107
type_list<core_dimensions<>
,
core_dimensions<>
>,
108
trailing_core
,
109
output_batch::broadcast_target
110
>;
111
118
using
reduction_shape_rule
=
operand_shape_rule
<
119
type_list<>
,
120
type_list<core_dimensions<>
>,
121
type_list<core_dimensions<axis_run<>
>>,
122
named_core<axes_of, keep_dimensions_of>
123
>;
124
132
using
extremum_reduction_shape_rule
=
operand_shape_rule
<
133
type_list<>
,
134
type_list<core_dimensions<>
>,
135
type_list<core_dimensions<axis_run<positive_extent_domain>
>>,
136
named_core<axes_of, keep_dimensions_of>
137
>;
138
145
using
vector_dot_shape_rule
=
operand_shape_rule
<
146
type_list<extent_from_inputs<>
>,
147
type_list<core_dimensions<>
>,
148
type_list
<
149
core_dimensions<axis_same_as<0>
>,
150
core_dimensions<axis_same_as<0>
>
151
>,
152
named_core<axes_of, keep_dimensions_of>
153
>;
154
159
using
cross_product_shape_rule
=
operand_shape_rule
<
160
type_list<extent_fixed<3>
>,
161
type_list<core_dimensions<axis_same_as<0>
>>,
162
type_list
<
163
core_dimensions<axis_same_as<0>
>,
164
core_dimensions<axis_same_as<0>
>
165
>,
166
named_core<axes_of>
167
>;
168
173
using
fourier_transform_shape_rule
=
operand_shape_rule
<
174
type_list<>
,
175
type_list<core_dimensions<axis_run<>
>>,
176
type_list<core_dimensions<axis_run<positive_extent_domain>
>>,
177
named_core<axes_of>
178
>;
179
184
using
axiswise_shape_rule
=
operand_shape_rule
<
185
type_list<>
,
186
type_list<core_dimensions<axis_run<>
>>,
187
type_list<core_dimensions<axis_run<>
>>,
188
named_core<axes_of>
189
>;
190
199
using
keyed_axiswise_shape_rule
=
operand_shape_rule
<
200
type_list<>
,
201
type_list<core_dimensions<axis_run<>
>>,
202
type_list<core_dimensions<axis_run<>
>,
core_dimensions<>
>,
203
named_core<axes_of>
204
>;
205
212
using
real_fourier_transform_shape_rule
=
operand_shape_rule
<
213
type_list<extent_from_inputs<positive_extent_domain>
>,
214
type_list<core_dimensions<axis_run<>
,
axis_half_spectrum_of<0>
>>,
215
type_list
<
216
core_dimensions<axis_run<positive_extent_domain>
,
axis_same_as<0>
>
217
>,
218
named_core<axes_of>
219
>;
220
227
using
inverse_real_fourier_transform_shape_rule
=
operand_shape_rule
<
228
type_list<extent_from_operation<extent_of, positive_extent_domain>
>,
229
type_list<core_dimensions<axis_run<>
,
axis_same_as<0>
>>,
230
type_list
<
231
core_dimensions
<
232
axis_run<positive_extent_domain>
,
233
axis_half_spectrum_of<0>
234
>
235
>,
236
named_core<axes_of>
237
>;
238
242
using
matrix_multiply_shape_rule
=
operand_shape_rule
<
243
type_list
<
244
extent_from_inputs<>
,
245
extent_from_inputs<>
,
246
extent_from_inputs<>
247
>,
248
type_list<core_dimensions<axis_same_as<0>
,
axis_same_as<2>
>>,
249
type_list
<
250
core_dimensions<axis_same_as<0>
,
axis_same_as<1>
>,
251
core_dimensions<axis_same_as<1>
,
axis_same_as<2>
>
252
>
253
>;
254
258
using
matrix_vector_shape_rule
=
operand_shape_rule
<
259
type_list<extent_from_inputs<>
,
extent_from_inputs<>
>,
260
type_list<core_dimensions<axis_same_as<0>
>>,
261
type_list
<
262
core_dimensions<axis_same_as<0>
,
axis_same_as<1>
>,
263
core_dimensions<axis_same_as<1>
>
264
>
265
>;
266
270
using
vector_matrix_shape_rule
=
operand_shape_rule
<
271
type_list<extent_from_inputs<>
,
extent_from_inputs<>
>,
272
type_list<core_dimensions<axis_same_as<1>
>>,
273
type_list
<
274
core_dimensions<axis_same_as<0>
>,
275
core_dimensions<axis_same_as<0>
,
axis_same_as<1>
>
276
>
277
>;
278
282
using
sequence_shape_rule
=
operand_shape_rule
<
283
type_list<extent_from_operation<count_of>
>,
284
type_list<core_dimensions<axis_same_as<0>
>>,
285
type_list<>
286
>;
287
295
using
elementwise_sequence_shape_rule
=
operand_shape_rule
<
296
type_list<extent_from_operation<count_of>
>,
297
type_list<core_dimensions<axis_same_as<0>
>>,
298
type_list<core_dimensions<>
>
299
>;
300
303
}
// namespace ops
304
}
// namespace rexlib
rexlib::array
Container for multidimensional numeric data.
Definition
array.hpp:31
rexlib
Arrays, the operations on them and the devices that run those operations.
Definition
cpu_device.hpp:10
rexlib::output_batch::broadcast_target
@ broadcast_target
Any the inputs broadcast to, shared by every output.
rexlib::core_dimensions
The core axes of one operand.
Definition
core_dimensions.hpp:78
rexlib::operand_shape_rule
Declarative shape rule for the operands of an operation.
Definition
operand_shape_rule.hpp:288
rexlib::trailing_core
Placement of the core axes at the end of every operand.
Definition
trailing_core.hpp:20
rexlib::type_list
Helper class to pass a heterogeneous sequence of types to a function.
Definition
type_list.hpp:20
Generated by
1.9.8