Commit a7d39d7b by Yuwei Hu Committed by Tianqi Chen

[Relay][Frontend] Keras Support (#2336)

parent c9a3e2ea
......@@ -8,3 +8,4 @@ for Relay.
from __future__ import absolute_import
from .mxnet import from_mxnet
from .keras import from_keras
"""Common utilities"""
from __future__ import absolute_import as _abs
from .. import expr as _expr
class RequiredAttr(object):
......@@ -181,8 +182,6 @@ class StrAttrsDict(object):
raise AttributeError("Required attribute {} not found.".format(key))
return default
def get_bool(self, key, default=RequiredAttr()):
"""Get bool tuple attribute
......@@ -204,3 +203,27 @@ class StrAttrsDict(object):
if isinstance(default, RequiredAttr):
raise AttributeError("Required attribute {} not found.".format(key))
return default
class ExprTable(object):
"""Table storing Relay expressions by names."""
def __init__(self):
self.exprs = {}
self.params = {}
self.const_ctr = 1
def new_const(self, value, shape=None, dtype="float32"):
name = "_param_%d" % (self.const_ctr)
if hasattr(value, "shape"):
shape = value.shape
self.const_ctr += 1
self.params[name] = value
self.exprs[name] = _expr.var(name_hint=name, shape=shape, dtype=dtype)
return self.exprs[name]
def get_expr(self, name):
return self.exprs[name]
def set_expr(self, name, expr):
assert isinstance(expr, _expr.Expr)
self.exprs[name] = expr
......@@ -8,21 +8,27 @@ export OMP_NUM_THREADS=1
make cython || exit -1
make cython3 || exit -1
echo "Running unittest..."
echo "Running nnvm unittest..."
python -m nose -v nnvm/tests/python/unittest || exit -1
python3 -m nose -v nnvm/tests/python/unittest || exit -1
echo "Running compiler test..."
echo "Running nnvm compiler test..."
python3 -m nose -v nnvm/tests/python/compiler || exit -1
echo "Running ONNX frontend test..."
echo "Running nnvm ONNX frontend test..."
python3 -m nose -v nnvm/tests/python/frontend/onnx || exit -1
echo "Running MXNet frontend test..."
echo "Running nnvm MXNet frontend test..."
python3 -m nose -v nnvm/tests/python/frontend/mxnet || exit -1
echo "Running Keras frontend test..."
echo "Running nnvm Keras frontend test..."
python3 -m nose -v nnvm/tests/python/frontend/keras || exit -1
echo "Running Tensorflow frontend test..."
echo "Running nnvm Tensorflow frontend test..."
python3 -m nose -v nnvm/tests/python/frontend/tensorflow || exit -1
echo "Running relay MXNet frontend test..."
python3 -m nose -v tests/python/frontend/mxnet || exit -1
echo "Running relay Keras frontend test..."
python3 -m nose -v tests/python/frontend/keras || exit -1
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