Skip to content

Commit

Permalink
Update TVM Version, Init Jenkins, Fix Lint (#3)
Browse files Browse the repository at this point in the history
* Update TVM Version

* Fix Lint and Jenkins

* fix workspace

* fix doxygen complain

* move test to nose
  • Loading branch information
tqchen authored and jroesch committed Aug 16, 2018
1 parent f07c1af commit 40771ef
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 43 deletions.
84 changes: 45 additions & 39 deletions relay/include/relay/node.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/*!
* Copyright (c) 2018 by Contributors
* \file relay/node.h
* \brief Graph node data structure.
* \file nnvm/relay/node.h
* \brief Relay node data structure.
*/
#ifndef NNVM_RELAY_NODE_H_
#define NNVM_RELAY_NODE_H_

#include <tvm/node.h>
#include <tvm/api_registry.h>
#include <nnvm/node.h>
#include <string>

namespace nnvm {

Expand Down Expand Up @@ -46,77 +49,80 @@ inline const StringNode* String::operator->() const {
}

class ScalarLitNode : public tvm::Node {
public:
double value;// The AST should be able to store aribtrary precision numbers, maybe store as string?
public:
// The AST should be able to store aribtrary precision numbers, maybe store as string?
double value;

ScalarLitNode() {}
ScalarLitNode() {}

void VisitAttrs(tvm::AttrVisitor* v) final {
v->Visit("value", &value);
}
void VisitAttrs(tvm::AttrVisitor* v) final {
v->Visit("value", &value);
}

TVM_DLL static NodeRef make(double value);
TVM_DLL static NodeRef make(double value);

static constexpr const char* _type_key = "nnvm.ScalarLit";
TVM_DECLARE_NODE_TYPE_INFO(ScalarLitNode, Node);
static constexpr const char* _type_key = "nnvm.ScalarLit";
TVM_DECLARE_NODE_TYPE_INFO(ScalarLitNode, Node);
};

TVM_REGISTER_NODE_TYPE(ScalarLitNode);
TVM_DEFINE_NODE_REF(ScalarLit, ScalarLitNode);

class IntLitNode : public tvm::Node {
public:
// The AST should be able to store aribtrary precision numbers, maybe store as string?
int value;
public:
// The AST should be able to store aribtrary precision numbers, maybe store as string?
int value;

IntLitNode() {}
IntLitNode() {}

void VisitAttrs(tvm::AttrVisitor* v) final {
v->Visit("value", &value);
}
void VisitAttrs(tvm::AttrVisitor* v) final {
v->Visit("value", &value);
}

TVM_DLL static NodeRef make(int value);
TVM_DLL static NodeRef make(int value);

static constexpr const char* _type_key = "nnvm.IntLit";
TVM_DECLARE_NODE_TYPE_INFO(IntLitNode, Node);
static constexpr const char* _type_key = "nnvm.IntLit";
TVM_DECLARE_NODE_TYPE_INFO(IntLitNode, Node);
};

TVM_DEFINE_NODE_REF(IntLit, IntLitNode);

class BoolLitNode : public tvm::Node {
public:
bool value;
public:
bool value;

BoolLitNode() {}
BoolLitNode() {}

void VisitAttrs(tvm::AttrVisitor* v) final {
v->Visit("value", &value);
}
void VisitAttrs(tvm::AttrVisitor* v) final {
v->Visit("value", &value);
}

TVM_DLL static NodeRef make(bool value);
TVM_DLL static NodeRef make(bool value);

static constexpr const char* _type_key = "nnvm.BoolLit";
TVM_DECLARE_NODE_TYPE_INFO(BoolLitNode, Node);
static constexpr const char* _type_key = "nnvm.BoolLit";
TVM_DECLARE_NODE_TYPE_INFO(BoolLitNode, Node);
};

TVM_DEFINE_NODE_REF(BoolLit, BoolLitNode);

class TensorLitNode : public tvm::Node {
public:
tvm::Array<tvm::NodeRef> data;
public:
tvm::Array<tvm::NodeRef> data;

TensorLitNode() {}
TensorLitNode() {}

void VisitAttrs(tvm::AttrVisitor* v) final {
v->Visit("data", &data);
}
void VisitAttrs(tvm::AttrVisitor* v) final {
v->Visit("data", &data);
}

TVM_DLL static NodeRef make(tvm::Array<tvm::NodeRef> data);
TVM_DLL static NodeRef make(tvm::Array<tvm::NodeRef> data);

static constexpr const char* _type_key = "nnvm.TensorLit";
TVM_DECLARE_NODE_TYPE_INFO(TensorLitNode, Node);
static constexpr const char* _type_key = "nnvm.TensorLit";
TVM_DECLARE_NODE_TYPE_INFO(TensorLitNode, Node);
};

TVM_DEFINE_NODE_REF(TensorLit, TensorLitNode);

} // namespace nnvm

#endif // NNVM_RELAY_NODE_H_
4 changes: 2 additions & 2 deletions relay/python/relay/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import tvm
"""Base namespace of relay."""
# pylint: disable=unused-import
from tvm._ffi.node import NodeBase, register_node as _register_tvm_node

def register_nnvm_node(type_key=None):
Expand All @@ -12,4 +13,3 @@ def register_nnvm_node(type_key=None):
if not isinstance(type_key, str):
return _register_tvm_node("nnvm." + type_key.__name__)(type_key)
return _register_tvm_node(type_key)

2 changes: 1 addition & 1 deletion relay/python/relay/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class String(Expr):
class IntLit(Expr):
pass


@register_nnvm_node
class ScalarLit(Expr):
pass
Expand All @@ -29,4 +30,3 @@ class BoolLit(Expr):
@register_nnvm_node
class TensorLit(Expr):
pass

7 changes: 6 additions & 1 deletion relay/src/relay/node.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*!
* Copyright (c) 2018 by Contributors
* \file node.cc
* \brief Relay node data structure.
*/
#include <nnvm/relay/node.h>

namespace nnvm {
Expand Down Expand Up @@ -59,4 +64,4 @@ TVM_REGISTER_API("nnvm.make.TensorLit")
*ret = TensorLitNode::make(args[0]);
});

} // namespace nnnvm
} // namespace nnvm

0 comments on commit 40771ef

Please sign in to comment.