提交 2513aa4c 编写于 作者: W wangliu

Merge remote-tracking branch 'upstream/develop' into develop

# Conflicts:
#	CMakeLists.txt
#	src/framework/dim.h
#	src/framework/program/program-optimize/node.h
上级 92c7ea22
......@@ -12,8 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#include "common/log.h"
#include "common/enforce.h"
#include "common/log.h"
#pragma once
......@@ -56,7 +56,6 @@ class RawData {
char data[size];
RawData() {}
RawData(const RawData &raw_data) { strcpy(data, raw_data.data); }
};
template <typename... Ts>
......
......@@ -128,7 +128,6 @@ class Attribute {
return vistor(attr.variant_.Get<int64_t>());
} else {
PADDLE_MOBILE_THROW_EXCEPTION("type not support");
}
}
......
......@@ -151,7 +151,7 @@ DDim DDim::operator+(DDim d) const {
std::vector<int64_t> v3;
PADDLE_MOBILE_ENFORCE(v1.size() == v2.size(),"v1.size() != v2.size()");
PADDLE_MOBILE_ENFORCE(v1.size() == v2.size(), "v1.size() != v2.size()");
for (unsigned int i = 0; i < v1.size(); i++) {
v3.push_back(v1[i] + v2[i]);
......@@ -277,30 +277,30 @@ int arity(const DDim &d) {
ArityVisitor arityVisitor = ArityVisitor();
return DDim::ApplyVistor(arityVisitor, d);
}
/// \cond HIDDEN
/// \cond HIDDEN
/// \endcond
/// \endcond
// struct OSVistor : Vistor<std::ostream &> {
// OSVistor(std::ostream &os) : os_(os) {}
//
// template <int D>
// std::ostream &operator()(Dim<D> dim) const {
// return os_ << dim;
// }
//
// private:
// std::ostream &os_;
//};
//struct OSVistor : Vistor<std::ostream &> {
// OSVistor(std::ostream &os) : os_(os) {}
//
// template <int D>
// std::ostream &operator()(Dim<D> dim) const {
// return os_ << dim;
// }
//
// private:
// std::ostream &os_;
//};
//std::ostream &operator<<(std::ostream &os, const DDim &ddim) {
// auto vistor = OSVistor(os);
// DDim::ApplyVistor(vistor, ddim);
// return os;
//}
// std::ostream &operator<<(std::ostream &os, const DDim &ddim) {
// auto vistor = OSVistor(os);
// DDim::ApplyVistor(vistor, ddim);
// return os;
//}
#ifdef PADDLE_MOBILE_DEBUG
inline Print &operator<<(Print &printer, const DDim &ddim) {
inline Print &operator<<(Print &printer, const DDim &ddim) {
for (int j = 0; j < ddim.size(); ++j) {
printer << ddim[j] << " ";
}
......
......@@ -16,9 +16,9 @@ limitations under the License. */
#include <initializer_list>
#include <vector>
#include "common/enforce.h"
#include "common/variant.h"
#include "dim.h"
#include "common/enforce.h"
namespace paddle_mobile {
namespace framework {
......@@ -57,7 +57,7 @@ struct DDim {
} else if (d.var.TypeId() == typeid(Dim<9>).hash_code()) {
return vistor(d.var.Get<Dim<9>>());
} else {
DLOG <<" dim not support";
DLOG << " dim not support";
}
}
......
......@@ -129,15 +129,12 @@ int64_t &indexer(Dim<D> &dim, int idx) {
template <>
int64_t &indexer<0>(Dim<0> &dim, int idx) {
PADDLE_MOBILE_THROW_EXCEPTION("Invalid index")
}
template <int D>
int64_t indexer(const Dim<D> &dim, int idx) {
if (idx < 0) {
PADDLE_MOBILE_THROW_EXCEPTION("Tried to access a negative dimension")
}
if (idx == 0) {
return dim.head;
......@@ -148,7 +145,6 @@ int64_t indexer(const Dim<D> &dim, int idx) {
template <>
int64_t indexer<0>(const Dim<0> &dim, int idx) {
PADDLE_MOBILE_THROW_EXCEPTION("Invalid index")
}
} // namespace
......@@ -331,7 +327,7 @@ Dim<sizeof...(Args)> make_dim(Args... idxes) {
// Allows us to output a Dim
// XXX For some reason, overloading fails to resolve this correctly
//template <int i>
// template <int i>
/*typename std::enable_if<(i > 1), std::ostream &>::type operator<<(
std::ostream &os, const Dim<i> &d) {
os << d.head << ", " << d.tail;l
......@@ -351,7 +347,5 @@ inline std::ostream &operator<<(std::ostream &os, const Dim<0> &d) {
return os;
}*/
} // namespace framework
} // namespace paddle_mobile
......@@ -17,7 +17,7 @@ limitations under the License. */
namespace paddle_mobile {
namespace framework {
//std::ostream &operator<<(std::ostream &os, const LoD &lod) {
// std::ostream &operator<<(std::ostream &os, const LoD &lod) {
// os << "{";
// for (auto &v : lod) {
// os << "{";
......@@ -37,7 +37,7 @@ namespace framework {
// return os;
//}
//
//std::ostream &operator<<(std::ostream &os, const LoDTensor &t) {
// std::ostream &operator<<(std::ostream &os, const LoDTensor &t) {
// PADDLE_MOBILE_ENFORCE(t.type().hash_code() == typeid(float).hash_code(),
// "t.type() is not float");
// os << "dim: " << t.dims() << "\n";
......@@ -51,7 +51,7 @@ namespace framework {
// return os;
//}
//std::string LoDToString(const LoD &lod) {
// std::string LoDToString(const LoD &lod) {
// std::ostringstream stream;
// stream << lod;
// return stream.str();
......
......@@ -17,7 +17,6 @@ limitations under the License. */
#include <map>
#include <string>
#include <vector>
#include "common/log.h"
#include "framework/program/op_desc.h"
......@@ -34,7 +33,6 @@ class Node {
: op_desc_(op_desc), type_(op_desc->Type()) {}
Node &operator>(std::shared_ptr<Node> node);
bool operator==(const Node &in);
bool CanSplit(std::unordered_set<std::string> complex_compute_set);
#ifdef PADDLE_MOBILE_DEBUG
std::string ToString() const;
......
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
//
// Created by Wang,Liu(MMS) on 2018/6/6.
//
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册