blob: a19f7e510d993f805e995232831f1cd831b18817 [file] [log] [blame]
Kaizen8938bd32017-09-28 14:38:23 +01001/*
2 * Copyright (c) 2017 ARM Limited.
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24#ifndef __ARM_COMPUTE_GRAPH_UTILS_H__
25#define __ARM_COMPUTE_GRAPH_UTILS_H__
26
27#include "arm_compute/graph/ITensorAccessor.h"
28#include "arm_compute/graph/Types.h"
29
30namespace arm_compute
31{
32namespace graph_utils
33{
34/** PPM writer class */
35class PPMWriter : public graph::ITensorAccessor
36{
37public:
38 /** Constructor
39 *
40 * @param[in] name PPM file name
41 * @param[in] maximum Maximum elements to access
42 */
43 PPMWriter(std::string name, unsigned int maximum = 1);
44 /** Allows instances to move constructed */
45 PPMWriter(PPMWriter &&) = default;
46
47 // Inherited methods overriden:
48 bool access_tensor(ITensor &tensor) override;
49
50private:
51 const std::string _name;
52 unsigned int _iterator;
53 unsigned int _maximum;
54};
55
56/** Dummy accessor class */
57class DummyAccessor : public graph::ITensorAccessor
58{
59public:
60 /** Constructor
61 *
62 * @param[in] maximum Maximum elements to write
63 */
64 DummyAccessor(unsigned int maximum = 1);
65 /** Allows instances to move constructed */
66 DummyAccessor(DummyAccessor &&) = default;
67
68 // Inherited methods overriden:
69 bool access_tensor(ITensor &tensor) override;
70
71private:
72 unsigned int _iterator;
73 unsigned int _maximum;
74};
75
76/** Numpy Binary loader class*/
77class NumPyBinLoader : public graph::ITensorAccessor
78{
79public:
80 /** Default Constructor
81 *
82 * @param filename Binary file name
83 */
84 NumPyBinLoader(std::string filename);
85 /** Allows instances to move constructed */
86 NumPyBinLoader(NumPyBinLoader &&) = default;
87
88 // Inherited methods overriden:
89 bool access_tensor(ITensor &tensor) override;
90
91private:
92 const std::string _filename;
93};
94} // namespace graph
95} // namespace arm_compute
96
97#endif /* __ARM_COMPUTE_GRAPH_UTILS_H__ */