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 tvm/runtime/debug.h |
22 | * \brief Helpers for debugging at runtime. |
23 | */ |
24 | #ifndef TVM_RUNTIME_DEBUG_H_ |
25 | #define TVM_RUNTIME_DEBUG_H_ |
26 | |
27 | #include <tvm/runtime/container/adt.h> |
28 | #include <tvm/runtime/ndarray.h> |
29 | |
30 | #include <ostream> |
31 | #include <string> |
32 | |
33 | namespace tvm { |
34 | namespace runtime { |
35 | |
36 | /*! |
37 | * \brief Helpers to describe runtime objects in human-friendly form. For \p nd_arrays we show their |
38 | * shapes and dtypes, but also their contents if 'small' and on the \p host_device (mostly so that |
39 | * we can see dynamic shapes as they are computed). For \p adts we show the ADT fields. For |
40 | * \p objects we dispatch to one of the above as appropriate. |
41 | */ |
42 | void AppendNDArray(std::ostream& os, const NDArray& nd_array, const DLDevice& host_device, |
43 | bool show_content = true); |
44 | void AppendADT(std::ostream& os, const ADT& adt, const DLDevice& host_device, |
45 | bool show_content = true); |
46 | void AppendRuntimeObject(std::ostream& os, const ObjectRef& object, const DLDevice& host_device, |
47 | bool show_content = true); |
48 | std::string RuntimeObject2String(const ObjectRef& object, const DLDevice& host_device, |
49 | bool show_content = true); |
50 | |
51 | } // namespace runtime |
52 | } // namespace tvm |
53 | |
54 | #endif // TVM_RUNTIME_DEBUG_H_ |
55 | |