%ifarch x86_64 aarch64
meson --buildtype=plain --werror --prefix=%{_prefix} --libdir=%{_libdir} --bindir=%{nnstexampledir} --includedir=%{_includedir} -DINSTALL_EXAMPLES=true build
+ export TEST_TENSORFLOW=1
%else
meson --buildtype=plain --werror --prefix=%{_prefix} --libdir=%{_libdir} --bindir=%{nnstexampledir} --includedir=%{_includedir} -DINSTALL_EXAMPLES=true -DENABLE_TENSORFLOW=false build
%endif
--- /dev/null
+#!/usr/bin/env python
+
+##
+# Copyright (C) 2018 Samsung Electronics
+# License: LGPL-2.1
+#
+# @file checkLabel.py
+# @brief Check the result label of tensorflow-lite model
+# @author HyoungJoo Ahn <hello.ahn@samsung.com>
+
+import sys
+import struct
+import string
+
+def readbyte (filename):
+ F = open(filename, 'r')
+ readbyte = F.read()
+ F.close()
+ return readbyte
+
+
+def readlabel (filename):
+ F = open(filename, 'r')
+ line = F.readlines()
+ F.close()
+ return line
+
+bytearr = readbyte(sys.argv[1])
+softmax = []
+for i in xrange(10):
+ byte = bytearr[i * 4] + bytearr[i * 4 + 1] + bytearr[i * 4 + 2] + bytearr[i * 4 + 3]
+ softmax.append(struct.unpack('f', byte))
+
+pred = softmax.index(max(softmax))
+answer = sys.argv[2].split('/')[1].split('.')[0].strip()
+exit(pred != string.atoi(answer))
--- /dev/null
+#!/usr/bin/env bash
+##
+## @file runTest.sh
+## @author HyoungJoo Ahn <hello.ahn@samsung.com>
+## @date Dec 17 2018
+## @brief SSAT Test Cases for NNStreamer
+##
+
+if [[ "$SSATAPILOADED" != "1" ]];then
+ SILENT=0
+ INDEPENDENT=1
+ search="ssat-api.sh"
+ source $search
+ printf "${Blue}Independent Mode${NC}
+"
+fi
+
+# This is compatible with SSAT (https://github.com/myungjoo/SSAT)
+testInit $1
+if [[ -z "${TEST_TENSORFLOW}" ]]; then
+ report
+fi
+
+# Test constant passthrough custom filter (1, 2)
+PATH_TO_PLUGIN="../../build"
+PATH_TO_MODEL="../test_models/models/mnist.pb"
+PATH_TO_DATA="data/9.raw"
+
+gstTest "--gst-plugin-path=${PATH_TO_PLUGIN} filesrc location=${PATH_TO_DATA} ! application/octet-stream ! tensor_converter input-dim=784:1 input-type=uint8 ! tensor_transform mode=arithmetic option=typecast:float32,add:-127.5,div:127.5 ! tensor_filter framework=tensorflow model=${PATH_TO_MODEL} input=784:1:1:1 inputtype=float32 inputname=input output=10:1:1:1 outputtype=float32 outputname=softmax ! filesink location=tensorfilter.out.log " 1 0 0 $PERFORMANCE
+python checkLabel.py tensorfilter.out.log ${PATH_TO_DATA}
+testResult $? 1 "Golden test comparison" 0 1
+
+report