Commit 58a8cde2 authored by Scott Cyphers's avatar Scott Cyphers

Disable warning that makes it hard to see the other warnings

Disable infinite recursion in ScalarConstant::node_id()
parent b839784e
......@@ -39,6 +39,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-padded")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-potentially-evaluated-expression") # Triggers false alarms on typeid
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-compare")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-weak-vtables") # Not ready for this yet
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-conversion")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-float-equal")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-duplicate-enum") # from numpy
......
......@@ -22,6 +22,8 @@
#include <string>
#include <type_traits>
#include "except.hpp"
namespace ngraph
{
namespace element
......@@ -49,92 +51,94 @@ namespace ngraph
const std::string m_cname;
};
// Provides a compile-time name for a C++ type.
// Used in TraitedType for the string that supplies the C++ type name.
template<typename T>
const char* traited_type_name()
{
throw ngraph_error("Unkmown type");
}
// Literals (and probably other things we don't know about yet) need to have their C++ types
// and element types coordinated. Every element type corresponds to a TraitedType which provides
// access to both the instance and the C++ type used to hold the value during compilation.
template <typename T, typename U>
template <typename T>
class TraitedType : public Type
{
protected:
TraitedType(const std::string& cname)
TraitedType()
: Type(sizeof(T) * 8,
std::is_floating_point<T>::value,
std::is_signed<T>::value,
cname)
traited_type_name<T>())
{
}
public:
// This is the C++ type used to hold a value of this element type during compilation
using type = T;
// This is a reference to an instance of this element type.
static const U& element_type(){
static U t;
// This returns a reference to an instance of this element type.
static const TraitedType<T>& element_type(){
static TraitedType<T> t;
return t;
}
};
class Float : public TraitedType<float, Float>
template<>
constexpr const char* traited_type_name<float>()
{
friend class TraitedType<float, Float>;
Float()
: TraitedType<float, Float>("float")
{
}
};
return "float";
}
using Float = TraitedType<float>;
class Int8 : public TraitedType<int8_t, Int8>
template<>
constexpr const char* traited_type_name<int8_t>()
{
friend class TraitedType<int8_t, Int8>;
Int8()
: TraitedType<int8_t, Int8>("int8_t")
{
}
};
class Int32 : public TraitedType<int32_t, Int32>
return "int8_t";
}
using Int8 = TraitedType<int8_t>;
template<>
constexpr const char* traited_type_name<int32_t>()
{
friend class TraitedType<int32_t, Int32>;
Int32()
: TraitedType<int32_t, Int32>("int32_t")
{
}
};
return "int32_t";
}
class Int64 : public TraitedType<int64_t, Int64>
using Int32 = TraitedType<int32_t>;
template<>
constexpr const char* traited_type_name<int64_t>()
{
friend class TraitedType<int64_t, Int64>;
Int64()
: TraitedType<int64_t, Int64>("int64_t")
{
}
};
return "int64_t";
}
using Int64 = TraitedType<int64_t>;
class UInt8 : public TraitedType<uint8_t, UInt8>
template<>
constexpr const char* traited_type_name<uint8_t>()
{
friend class TraitedType<uint8_t, UInt8>;
UInt8()
: TraitedType<uint8_t, UInt8>("uint8_t")
{
}
};
class UInt32 : public TraitedType<uint32_t, UInt32>
return "uint8_t";
}
using UInt8 = TraitedType<uint8_t>;
template<>
constexpr const char* traited_type_name<uint32_t>()
{
friend class TraitedType<uint32_t, UInt32>;
UInt32()
: TraitedType<uint32_t, UInt32>("uint32_t")
{
}
};
return "uint32_t";
}
using UInt32 = TraitedType<uint32_t>;
class UInt64 : public TraitedType<uint64_t, UInt64>
template<>
constexpr const char* traited_type_name<uint64_t>()
{
friend class TraitedType<uint64_t, UInt64>;
UInt64()
: TraitedType<uint64_t, UInt64>("uint64_t")
{
}
};
return "uint64_t";
}
using UInt64 = TraitedType<uint64_t>;
}
}
......@@ -67,8 +67,8 @@ namespace ngraph
return typeid(*this) == typeid(*node.get());
}
virtual bool is_op() const { return false; };
virtual bool is_parameter() const { return false; };
virtual bool is_op() const { return false; }
virtual bool is_parameter() const { return false; }
size_t instance_id() const { return m_instance_id; }
friend std::ostream& operator<<(std::ostream&, const Node&);
......
......@@ -53,7 +53,7 @@ namespace ngraph
virtual std::string node_id() const override
{
std::stringstream ss;
ss << description() << "_" << node_id();
ss << description() << "_" /* << node_id() */;
return ss.str();
}
......
......@@ -41,7 +41,7 @@ namespace ngraph
std::string description() const override { return "Parameter"; }
virtual void propagate_types() override;
virtual std::string node_id() const override;
virtual bool is_parameter() const override { return true; };
virtual bool is_parameter() const override { return true; }
protected:
Function* m_function;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment