ONE - On-device Neural Engine
Loading...
Searching...
No Matches
LogHelper.cpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved
3 *
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
17#include "LogHelper.h"
18
19namespace loco
20{
21
22std::ostream &operator<<(std::ostream &os, const loco::FeatureShape &feature_shape)
23{
24 os << "[" << feature_shape.count().value() << "," << feature_shape.height().value() << ","
25 << feature_shape.width().value() << "," << feature_shape.depth().value() << "]";
26 return os;
27}
28
29std::ostream &operator<<(std::ostream &os, const loco::FilterShape &filter_shape)
30{
31 os << "[" << filter_shape.height().value() << "," << filter_shape.width().value() << ","
32 << filter_shape.depth().value() << "," << filter_shape.count().value() << "]";
33 return os;
34}
35
36std::ostream &operator<<(std::ostream &os, const loco::TensorShape &tensor_shape)
37{
38 os << "[";
39 for (uint32_t r = 0; r < tensor_shape.rank(); ++r)
40 {
41 if (r)
42 os << ",";
43 os << tensor_shape.dim(r).value();
44 }
45 os << "]";
46 return os;
47}
48
49std::ostream &operator<<(std::ostream &os, const loco::Padding2D &pad)
50{
51 os << "[TLBR " << pad.top() << "," << pad.left() << "," << pad.bottom() << "," << pad.right()
52 << "]";
53
54 return os;
55}
56
57} // namespace loco
58
59std::ostream &operator<<(std::ostream &os, const std::vector<int64_t> &vi64)
60{
61 for (auto vi : vi64)
62 {
63 os << vi << " ";
64 }
65 return os;
66}
67
68#include "TFFormattedGraph.h"
69
70namespace moco
71{
72namespace tf
73{
74
76{
77 auto node_summary_builder = std::make_unique<TFNodeSummaryBuilderFactory>();
78 return std::move(locop::fmt<locop::LinearV1>(g).with(std::move(node_summary_builder)));
79}
80
81} // namespace tf
82} // namespace moco
uint32_t value(void) const
Return the value.
Definition Dimension.h:51
Feature Map Shape.
const Dimension & depth(void) const
const Dimension & height(void) const
const Dimension & width(void) const
const Dimension & count(void) const
Filter Shape.
Definition FilterShape.h:43
const Dimension & count(void) const
Definition FilterShape.h:48
const Dimension & depth(void) const
Definition FilterShape.h:51
const Dimension & height(void) const
Definition FilterShape.h:54
const Dimension & width(void) const
Definition FilterShape.h:57
A neural network graph.
Definition Graph.h:161
uint32_t left(void) const
Definition Padding2D.h:49
uint32_t top(void) const
Definition Padding2D.h:41
uint32_t bottom(void) const
Definition Padding2D.h:45
uint32_t right(void) const
Definition Padding2D.h:53
const Dimension & dim(uint32_t axis) const
Definition TensorShape.h:38
uint32_t rank(void) const
Definition TensorShape.h:35
std::ostream & operator<<(std::ostream &os, const std::vector< int64_t > &vi64)
dump std::vector<int64_t> values to stream
Definition LogHelper.cpp:59
std::ostream & operator<<(std::ostream &os, const loco::FeatureShape &feature_shape)
dump FeatureShape values to stream
Definition LogHelper.cpp:22
FormattedGraph fmt(loco::Graph *g)
Definition LogHelper.cpp:75
Definition Log.h:23