blob: a06dcccbc4bb26c771b02721d280d397a1a2424e [file] [log] [blame]
Eric Kunzee5e26762020-10-13 16:11:07 -07001
Won Jeon2c34b462024-02-06 18:37:00 +00002// Copyright (c) 2020-2024, ARM Limited.
Eric Kunzee5e26762020-10-13 16:11:07 -07003//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16#ifndef OPS_TYPE_CONVERSION_H
17#define OPS_TYPE_CONVERSION_H
18
19#include "graph_node.h"
20
21using namespace tosa;
22
23namespace TosaReference
24{
Tai Lya4d748b2023-03-28 22:06:56 +000025template <int Rank, TOSA_REF_TYPE InDtype, TOSA_REF_TYPE OutDtype>
Eric Kunzee5e26762020-10-13 16:11:07 -070026class OpRescale : public GraphNode
27{
28public:
Eric Kunzeb5fabec2022-06-07 05:20:44 +000029 OpRescale(SubgraphTraverser* sgt_, TosaAttributeBase* attribute_, uint64_t id_);
Eric Kunzee5e26762020-10-13 16:11:07 -070030 virtual ~OpRescale();
31
32 virtual int checkTensorAttributes() final;
33 virtual int eval() final;
34
Tai Ly6e1e2bc2024-03-01 20:59:32 +000035 using InEigenType = typename GetEigenType<InDtype>::type;
36 using OutEigenType = typename GetEigenType<OutDtype>::type;
37 using TIn = Eigen::Tensor<InEigenType, Rank>;
38 using TOut = Eigen::Tensor<OutEigenType, Rank>;
39 using I8EigenType = typename GetEigenType<TOSA_REF_TYPE::TOSA_REF_TYPE_INT8>::type;
40 using I16EigenType = typename GetEigenType<TOSA_REF_TYPE::TOSA_REF_TYPE_INT16>::type;
41 using I32EigenType = typename GetEigenType<TOSA_REF_TYPE::TOSA_REF_TYPE_INT32>::type;
42 using TMultiplierI16 = Eigen::Tensor<I16EigenType, 1>;
43 using TMultiplierI32 = Eigen::Tensor<I32EigenType, 1>;
44 using TShift = Eigen::Tensor<I8EigenType, 1>;
Eric Kunzee5e26762020-10-13 16:11:07 -070045
46 static constexpr int32_t QMin = GetQMin<OutDtype>::value;
47 static constexpr int32_t QMax = GetQMax<OutDtype>::value;
48
49protected:
50 TosaRescaleAttribute* attribute;
51 TosaReference::TensorTemplate<TIn>* in;
52 TosaReference::TensorTemplate<TOut>* out;
Tai Ly6e1e2bc2024-03-01 20:59:32 +000053 TosaReference::TensorTemplate<TMultiplierI16>* multiplierI16;
54 TosaReference::TensorTemplate<TMultiplierI32>* multiplierI32;
55 TosaReference::TensorTemplate<TShift>* shift;
Eric Kunzee5e26762020-10-13 16:11:07 -070056};
57
Tai Lya4d748b2023-03-28 22:06:56 +000058template <TOSA_REF_TYPE InDtype, TOSA_REF_TYPE OutDtype>
Eric Kunzee5e26762020-10-13 16:11:07 -070059class CastHelper
60{
61public:
62 using InEigenType = typename GetEigenType<InDtype>::type;
63 using OutEigenType = typename GetEigenType<OutDtype>::type;
64 using FcnType = std::function<OutEigenType(InEigenType)>;
65 static constexpr int32_t OutBits = GetNumBits<OutDtype>::value;
66 CastHelper();
67 const FcnType& get_fcn() const
68 {
69 return fcn;
70 }
71
72private:
73 FcnType fcn;
74};
75
Tai Lya4d748b2023-03-28 22:06:56 +000076template <TOSA_REF_TYPE InDtype>
77class CastHelper<InDtype, TOSA_REF_TYPE_BOOL>
Eric Kunzee5e26762020-10-13 16:11:07 -070078{
79public:
80 using InEigenType = typename GetEigenType<InDtype>::type;
Tai Lya4d748b2023-03-28 22:06:56 +000081 using OutEigenType = typename GetEigenType<TOSA_REF_TYPE_BOOL>::type;
Eric Kunzee5e26762020-10-13 16:11:07 -070082 using FcnType = std::function<OutEigenType(InEigenType)>;
83 CastHelper();
84 const FcnType& get_fcn() const
85 {
86 return fcn;
87 }
88
89private:
90 FcnType fcn;
91};
92
Tai Lya4d748b2023-03-28 22:06:56 +000093template <TOSA_REF_TYPE OutDtype>
94class CastHelper<TOSA_REF_TYPE_BOOL, OutDtype>
Eric Kunzee5e26762020-10-13 16:11:07 -070095{
96public:
Tai Lya4d748b2023-03-28 22:06:56 +000097 using InEigenType = typename GetEigenType<TOSA_REF_TYPE_BOOL>::type;
Eric Kunzee5e26762020-10-13 16:11:07 -070098 using OutEigenType = typename GetEigenType<OutDtype>::type;
99 using FcnType = std::function<OutEigenType(InEigenType)>;
100 static constexpr int32_t OutMin = GetQMin<OutDtype>::value;
101 static constexpr int32_t OutMax = GetQMax<OutDtype>::value;
102 CastHelper();
103 const FcnType& get_fcn() const
104 {
105 return fcn;
106 }
107
108private:
109 FcnType fcn;
110};
111
Tai Lya4d748b2023-03-28 22:06:56 +0000112template <TOSA_REF_TYPE InDtype>
113class CastHelper<InDtype, TOSA_REF_TYPE_FP16>
James Ward8b390432022-08-12 20:48:56 +0100114{
115public:
116 using InEigenType = typename GetEigenType<InDtype>::type;
Tai Lya4d748b2023-03-28 22:06:56 +0000117 using OutEigenType = typename GetEigenType<TOSA_REF_TYPE_FP16>::type;
James Ward8b390432022-08-12 20:48:56 +0100118 using FcnType = std::function<OutEigenType(InEigenType)>;
119 CastHelper();
120 const FcnType& get_fcn() const
121 {
122 return fcn;
123 }
124
125private:
126 FcnType fcn;
127};
128
Tai Lya4d748b2023-03-28 22:06:56 +0000129template <TOSA_REF_TYPE OutDtype>
130class CastHelper<TOSA_REF_TYPE_FP16, OutDtype>
James Ward8b390432022-08-12 20:48:56 +0100131{
132public:
Tai Lya4d748b2023-03-28 22:06:56 +0000133 using InEigenType = typename GetEigenType<TOSA_REF_TYPE_FP16>::type;
James Ward8b390432022-08-12 20:48:56 +0100134 using OutEigenType = typename GetEigenType<OutDtype>::type;
135 using FcnType = std::function<OutEigenType(InEigenType)>;
136 static constexpr int32_t OutMin = GetQMin<OutDtype>::value;
137 static constexpr int32_t OutMax = GetQMax<OutDtype>::value;
138 CastHelper();
139 const FcnType& get_fcn() const
140 {
141 return fcn;
142 }
143
144private:
145 FcnType fcn;
146};
147
James Ward736fd1a2023-01-23 17:13:37 +0000148template <>
Tai Lya4d748b2023-03-28 22:06:56 +0000149class CastHelper<TOSA_REF_TYPE_FP32, TOSA_REF_TYPE_FP16>
James Ward736fd1a2023-01-23 17:13:37 +0000150{
151public:
Tai Lya4d748b2023-03-28 22:06:56 +0000152 using InEigenType = typename GetEigenType<TOSA_REF_TYPE_FP32>::type;
153 using OutEigenType = typename GetEigenType<TOSA_REF_TYPE_FP16>::type;
James Ward736fd1a2023-01-23 17:13:37 +0000154 using FcnType = std::function<OutEigenType(InEigenType)>;
155 CastHelper();
156 const FcnType& get_fcn() const
157 {
158 return fcn;
159 }
160
161private:
162 FcnType fcn;
163};
164
Tai Lya4d748b2023-03-28 22:06:56 +0000165template <TOSA_REF_TYPE InDtype>
166class CastHelper<InDtype, TOSA_REF_TYPE_BF16>
James Ward736fd1a2023-01-23 17:13:37 +0000167{
168public:
169 using InEigenType = typename GetEigenType<InDtype>::type;
Tai Lya4d748b2023-03-28 22:06:56 +0000170 using OutEigenType = typename GetEigenType<TOSA_REF_TYPE_BF16>::type;
James Ward736fd1a2023-01-23 17:13:37 +0000171 using FcnType = std::function<OutEigenType(InEigenType)>;
172 CastHelper();
173 const FcnType& get_fcn() const
174 {
175 return fcn;
176 }
177
178private:
179 FcnType fcn;
180};
181
Tai Lya4d748b2023-03-28 22:06:56 +0000182template <TOSA_REF_TYPE OutDtype>
183class CastHelper<TOSA_REF_TYPE_BF16, OutDtype>
James Ward736fd1a2023-01-23 17:13:37 +0000184{
185public:
Tai Lya4d748b2023-03-28 22:06:56 +0000186 using InEigenType = typename GetEigenType<TOSA_REF_TYPE_BF16>::type;
James Ward736fd1a2023-01-23 17:13:37 +0000187 using OutEigenType = typename GetEigenType<OutDtype>::type;
188 using FcnType = std::function<OutEigenType(InEigenType)>;
189 static constexpr int32_t OutMin = GetQMin<OutDtype>::value;
190 static constexpr int32_t OutMax = GetQMax<OutDtype>::value;
191 CastHelper();
192 const FcnType& get_fcn() const
193 {
194 return fcn;
195 }
196
197private:
198 FcnType fcn;
199};
200
201template <>
Tai Lya4d748b2023-03-28 22:06:56 +0000202class CastHelper<TOSA_REF_TYPE_FP32, TOSA_REF_TYPE_BF16>
James Ward736fd1a2023-01-23 17:13:37 +0000203{
204public:
Tai Lya4d748b2023-03-28 22:06:56 +0000205 using InEigenType = typename GetEigenType<TOSA_REF_TYPE_FP32>::type;
206 using OutEigenType = typename GetEigenType<TOSA_REF_TYPE_BF16>::type;
James Ward736fd1a2023-01-23 17:13:37 +0000207 using FcnType = std::function<OutEigenType(InEigenType)>;
208 CastHelper();
209 const FcnType& get_fcn() const
210 {
211 return fcn;
212 }
213
214private:
215 FcnType fcn;
216};
217
Tai Lya4d748b2023-03-28 22:06:56 +0000218template <TOSA_REF_TYPE InDtype>
219class CastHelper<InDtype, TOSA_REF_TYPE_FP32>
Eric Kunzee5e26762020-10-13 16:11:07 -0700220{
221public:
222 using InEigenType = typename GetEigenType<InDtype>::type;
Tai Lya4d748b2023-03-28 22:06:56 +0000223 using OutEigenType = typename GetEigenType<TOSA_REF_TYPE_FP32>::type;
Eric Kunzee5e26762020-10-13 16:11:07 -0700224 using FcnType = std::function<OutEigenType(InEigenType)>;
225 CastHelper();
226 const FcnType& get_fcn() const
227 {
228 return fcn;
229 }
230
231private:
232 FcnType fcn;
233};
234
James Ward736fd1a2023-01-23 17:13:37 +0000235template <>
Tai Lya4d748b2023-03-28 22:06:56 +0000236class CastHelper<TOSA_REF_TYPE_FP16, TOSA_REF_TYPE_FP32>
James Ward736fd1a2023-01-23 17:13:37 +0000237{
238public:
Tai Lya4d748b2023-03-28 22:06:56 +0000239 using InEigenType = typename GetEigenType<TOSA_REF_TYPE_FP16>::type;
240 using OutEigenType = typename GetEigenType<TOSA_REF_TYPE_FP32>::type;
James Ward736fd1a2023-01-23 17:13:37 +0000241 using FcnType = std::function<OutEigenType(InEigenType)>;
242 CastHelper();
243 const FcnType& get_fcn() const
244 {
245 return fcn;
246 }
247
248private:
249 FcnType fcn;
250};
251
252template <>
Tai Lya4d748b2023-03-28 22:06:56 +0000253class CastHelper<TOSA_REF_TYPE_BF16, TOSA_REF_TYPE_FP32>
James Ward736fd1a2023-01-23 17:13:37 +0000254{
255public:
Tai Lya4d748b2023-03-28 22:06:56 +0000256 using InEigenType = typename GetEigenType<TOSA_REF_TYPE_BF16>::type;
257 using OutEigenType = typename GetEigenType<TOSA_REF_TYPE_FP32>::type;
James Ward736fd1a2023-01-23 17:13:37 +0000258 using FcnType = std::function<OutEigenType(InEigenType)>;
259 CastHelper();
260 const FcnType& get_fcn() const
261 {
262 return fcn;
263 }
264
265private:
266 FcnType fcn;
267};
268
Tai Lya4d748b2023-03-28 22:06:56 +0000269template <TOSA_REF_TYPE OutDtype>
270class CastHelper<TOSA_REF_TYPE_FP32, OutDtype>
Eric Kunzee5e26762020-10-13 16:11:07 -0700271{
272public:
Tai Lya4d748b2023-03-28 22:06:56 +0000273 using InEigenType = typename GetEigenType<TOSA_REF_TYPE_FP32>::type;
Eric Kunzee5e26762020-10-13 16:11:07 -0700274 using OutEigenType = typename GetEigenType<OutDtype>::type;
275 using FcnType = std::function<OutEigenType(InEigenType)>;
276 static constexpr int32_t OutMin = GetQMin<OutDtype>::value;
277 static constexpr int32_t OutMax = GetQMax<OutDtype>::value;
278 CastHelper();
279 const FcnType& get_fcn() const
280 {
281 return fcn;
282 }
283
284private:
285 FcnType fcn;
286};
287
Tai Lya4d748b2023-03-28 22:06:56 +0000288template <TOSA_REF_TYPE OutDtype>
Won Jeon2c34b462024-02-06 18:37:00 +0000289class CastHelper<TOSA_REF_TYPE_FP8E4M3, OutDtype>
290{
291public:
292 using InEigenType = typename GetEigenType<TOSA_REF_TYPE_FP8E4M3>::type;
293 using OutEigenType = typename GetEigenType<OutDtype>::type;
294 using FcnType = std::function<OutEigenType(InEigenType)>;
295 static constexpr int32_t OutMin = GetQMin<OutDtype>::value;
296 static constexpr int32_t OutMax = GetQMax<OutDtype>::value;
297 CastHelper();
298 const FcnType& get_fcn() const
299 {
300 return fcn;
301 }
302
303private:
304 FcnType fcn;
305};
306
307template <>
308class CastHelper<TOSA_REF_TYPE_FP8E4M3, TOSA_REF_TYPE_FP16>
309{
310public:
311 using InEigenType = typename GetEigenType<TOSA_REF_TYPE_FP8E4M3>::type;
312 using OutEigenType = typename GetEigenType<TOSA_REF_TYPE_FP16>::type;
313 using FcnType = std::function<OutEigenType(InEigenType)>;
314 CastHelper();
315 const FcnType& get_fcn() const
316 {
317 return fcn;
318 }
319
320private:
321 FcnType fcn;
322};
323
324template <>
325class CastHelper<TOSA_REF_TYPE_FP8E4M3, TOSA_REF_TYPE_BF16>
326{
327public:
328 using InEigenType = typename GetEigenType<TOSA_REF_TYPE_FP8E4M3>::type;
329 using OutEigenType = typename GetEigenType<TOSA_REF_TYPE_BF16>::type;
330 using FcnType = std::function<OutEigenType(InEigenType)>;
331 CastHelper();
332 const FcnType& get_fcn() const
333 {
334 return fcn;
335 }
336
337private:
338 FcnType fcn;
339};
340
341template <>
342class CastHelper<TOSA_REF_TYPE_FP8E4M3, TOSA_REF_TYPE_FP32>
343{
344public:
345 using InEigenType = typename GetEigenType<TOSA_REF_TYPE_FP8E4M3>::type;
346 using OutEigenType = typename GetEigenType<TOSA_REF_TYPE_FP32>::type;
347 using FcnType = std::function<OutEigenType(InEigenType)>;
348 CastHelper();
349 const FcnType& get_fcn() const
350 {
351 return fcn;
352 }
353
354private:
355 FcnType fcn;
356};
357
358template <TOSA_REF_TYPE OutDtype>
359class CastHelper<TOSA_REF_TYPE_FP8E5M2, OutDtype>
360{
361public:
362 using InEigenType = typename GetEigenType<TOSA_REF_TYPE_FP8E5M2>::type;
363 using OutEigenType = typename GetEigenType<OutDtype>::type;
364 using FcnType = std::function<OutEigenType(InEigenType)>;
365 static constexpr int32_t OutMin = GetQMin<OutDtype>::value;
366 static constexpr int32_t OutMax = GetQMax<OutDtype>::value;
367 CastHelper();
368 const FcnType& get_fcn() const
369 {
370 return fcn;
371 }
372
373private:
374 FcnType fcn;
375};
376
377template <>
378class CastHelper<TOSA_REF_TYPE_FP8E5M2, TOSA_REF_TYPE_FP16>
379{
380public:
381 using InEigenType = typename GetEigenType<TOSA_REF_TYPE_FP8E5M2>::type;
382 using OutEigenType = typename GetEigenType<TOSA_REF_TYPE_FP16>::type;
383 using FcnType = std::function<OutEigenType(InEigenType)>;
384 CastHelper();
385 const FcnType& get_fcn() const
386 {
387 return fcn;
388 }
389
390private:
391 FcnType fcn;
392};
393
394template <>
395class CastHelper<TOSA_REF_TYPE_FP8E5M2, TOSA_REF_TYPE_BF16>
396{
397public:
398 using InEigenType = typename GetEigenType<TOSA_REF_TYPE_FP8E5M2>::type;
399 using OutEigenType = typename GetEigenType<TOSA_REF_TYPE_BF16>::type;
400 using FcnType = std::function<OutEigenType(InEigenType)>;
401 CastHelper();
402 const FcnType& get_fcn() const
403 {
404 return fcn;
405 }
406
407private:
408 FcnType fcn;
409};
410
411template <>
412class CastHelper<TOSA_REF_TYPE_FP8E5M2, TOSA_REF_TYPE_FP32>
413{
414public:
415 using InEigenType = typename GetEigenType<TOSA_REF_TYPE_FP8E5M2>::type;
416 using OutEigenType = typename GetEigenType<TOSA_REF_TYPE_FP32>::type;
417 using FcnType = std::function<OutEigenType(InEigenType)>;
418 CastHelper();
419 const FcnType& get_fcn() const
420 {
421 return fcn;
422 }
423
424private:
425 FcnType fcn;
426};
427
428template <TOSA_REF_TYPE InDtype>
429class CastHelper<InDtype, TOSA_REF_TYPE_FP8E4M3>
430{
431public:
432 using InEigenType = typename GetEigenType<InDtype>::type;
433 using OutEigenType = typename GetEigenType<TOSA_REF_TYPE_FP8E4M3>::type;
434 using FcnType = std::function<OutEigenType(InEigenType)>;
435 CastHelper();
436 const FcnType& get_fcn() const
437 {
438 return fcn;
439 }
440
441private:
442 FcnType fcn;
443};
444
445template <>
446class CastHelper<TOSA_REF_TYPE_FP16, TOSA_REF_TYPE_FP8E4M3>
447{
448public:
449 using InEigenType = typename GetEigenType<TOSA_REF_TYPE_FP16>::type;
450 using OutEigenType = typename GetEigenType<TOSA_REF_TYPE_FP8E4M3>::type;
451 using FcnType = std::function<OutEigenType(InEigenType)>;
452 CastHelper();
453 const FcnType& get_fcn() const
454 {
455 return fcn;
456 }
457
458private:
459 FcnType fcn;
460};
461
462template <>
463class CastHelper<TOSA_REF_TYPE_BF16, TOSA_REF_TYPE_FP8E4M3>
464{
465public:
466 using InEigenType = typename GetEigenType<TOSA_REF_TYPE_BF16>::type;
467 using OutEigenType = typename GetEigenType<TOSA_REF_TYPE_FP8E4M3>::type;
468 using FcnType = std::function<OutEigenType(InEigenType)>;
469 CastHelper();
470 const FcnType& get_fcn() const
471 {
472 return fcn;
473 }
474
475private:
476 FcnType fcn;
477};
478
479template <>
480class CastHelper<TOSA_REF_TYPE_FP32, TOSA_REF_TYPE_FP8E4M3>
481{
482public:
483 using InEigenType = typename GetEigenType<TOSA_REF_TYPE_FP32>::type;
484 using OutEigenType = typename GetEigenType<TOSA_REF_TYPE_FP8E4M3>::type;
485 using FcnType = std::function<OutEigenType(InEigenType)>;
486 CastHelper();
487 const FcnType& get_fcn() const
488 {
489 return fcn;
490 }
491
492private:
493 FcnType fcn;
494};
495
496template <TOSA_REF_TYPE InDtype>
497class CastHelper<InDtype, TOSA_REF_TYPE_FP8E5M2>
498{
499public:
500 using InEigenType = typename GetEigenType<InDtype>::type;
501 using OutEigenType = typename GetEigenType<TOSA_REF_TYPE_FP8E5M2>::type;
502 using FcnType = std::function<OutEigenType(InEigenType)>;
503 CastHelper();
504 const FcnType& get_fcn() const
505 {
506 return fcn;
507 }
508
509private:
510 FcnType fcn;
511};
512
513template <>
514class CastHelper<TOSA_REF_TYPE_FP16, TOSA_REF_TYPE_FP8E5M2>
515{
516public:
517 using InEigenType = typename GetEigenType<TOSA_REF_TYPE_FP16>::type;
518 using OutEigenType = typename GetEigenType<TOSA_REF_TYPE_FP8E5M2>::type;
519 using FcnType = std::function<OutEigenType(InEigenType)>;
520 CastHelper();
521 const FcnType& get_fcn() const
522 {
523 return fcn;
524 }
525
526private:
527 FcnType fcn;
528};
529
530template <>
531class CastHelper<TOSA_REF_TYPE_BF16, TOSA_REF_TYPE_FP8E5M2>
532{
533public:
534 using InEigenType = typename GetEigenType<TOSA_REF_TYPE_BF16>::type;
535 using OutEigenType = typename GetEigenType<TOSA_REF_TYPE_FP8E5M2>::type;
536 using FcnType = std::function<OutEigenType(InEigenType)>;
537 CastHelper();
538 const FcnType& get_fcn() const
539 {
540 return fcn;
541 }
542
543private:
544 FcnType fcn;
545};
546
547template <>
548class CastHelper<TOSA_REF_TYPE_FP32, TOSA_REF_TYPE_FP8E5M2>
549{
550public:
551 using InEigenType = typename GetEigenType<TOSA_REF_TYPE_FP32>::type;
552 using OutEigenType = typename GetEigenType<TOSA_REF_TYPE_FP8E5M2>::type;
553 using FcnType = std::function<OutEigenType(InEigenType)>;
554 CastHelper();
555 const FcnType& get_fcn() const
556 {
557 return fcn;
558 }
559
560private:
561 FcnType fcn;
562};
563
564template <TOSA_REF_TYPE OutDtype>
Tai Lya4d748b2023-03-28 22:06:56 +0000565class CastHelper<TOSA_REF_TYPE_FP64, OutDtype>
566{
567public:
568 using InEigenType = typename GetEigenType<TOSA_REF_TYPE_FP64>::type;
569 using OutEigenType = typename GetEigenType<OutDtype>::type;
570 using FcnType = std::function<OutEigenType(InEigenType)>;
571 static constexpr int32_t OutMin = GetQMin<OutDtype>::value;
572 static constexpr int32_t OutMax = GetQMax<OutDtype>::value;
573 CastHelper();
574 const FcnType& get_fcn() const
575 {
576 return fcn;
577 }
578
579private:
580 FcnType fcn;
581};
582
583template <int Rank, TOSA_REF_TYPE InDtype, TOSA_REF_TYPE OutDtype>
Eric Kunzee5e26762020-10-13 16:11:07 -0700584class OpCast : public GraphNode
585{
586public:
Eric Kunzeb5fabec2022-06-07 05:20:44 +0000587 OpCast(SubgraphTraverser* sgt_, TosaAttributeBase* attribute_, uint64_t id_);
Eric Kunzee5e26762020-10-13 16:11:07 -0700588 virtual ~OpCast();
589
590 virtual int checkTensorAttributes() final;
591 virtual int eval() final;
592
593 using InEigenType = typename GetEigenType<InDtype>::type;
594 using OutEigenType = typename GetEigenType<OutDtype>::type;
595 using TIn = Eigen::Tensor<InEigenType, Rank>;
596 using TOut = Eigen::Tensor<OutEigenType, Rank>;
597
598protected:
599 CastHelper<InDtype, OutDtype> cast_helper;
600 TosaReference::TensorTemplate<TIn>* in;
601 TosaReference::TensorTemplate<TOut>* out;
602};
603
604}; // namespace TosaReference
605
606#endif