1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20/*!
21 * \file codegen_params.h
22 */
23
24#ifndef TVM_TARGET_SOURCE_CODEGEN_PARAMS_H_
25#define TVM_TARGET_SOURCE_CODEGEN_PARAMS_H_
26
27#include <tvm/runtime/ndarray.h>
28
29#include <iostream>
30#include <string>
31
32namespace tvm {
33namespace codegen {
34
35/*!
36 * \brief Write a C representation of arr to os.
37 *
38 * This function generates a comma-separated, indented list of C integer listeals suitable for use
39 * in an initializer. The NDArray is flattened and then the list is produced element by element.
40 * For the int16_t NDArray [-3, -2, -1, 0, 1, 2, 3, ...], and indent_chars = 4, the following output
41 * is produced:
42 * -0x0003, -0x0002, -0x0001, +0x0000, +0x0001, +0x0002, +0x0003
43 *
44 * \param arr The array to generate
45 * \param indent_chars Number of chars to indent
46 * \param os Output stream where the array data should be written.
47 */
48void NDArrayDataToC(::tvm::runtime::NDArray arr, int indent_chars, std::ostream& os,
49 const std::string& eol = "\n");
50
51} // namespace codegen
52} // namespace tvm
53
54#endif // TVM_TARGET_SOURCE_CODEGEN_PARAMS_H_
55