diff --git a/spark/dl/src/test/scala/com/intel/analytics/bigdl/serving/InferenceSpec.scala b/spark/dl/src/test/scala/com/intel/analytics/bigdl/serving/InferenceSpec.scala new file mode 100644 index 00000000000..6d254d55b25 --- /dev/null +++ b/spark/dl/src/test/scala/com/intel/analytics/bigdl/serving/InferenceSpec.scala @@ -0,0 +1,36 @@ +/* + * Copyright 2018 Analytics Zoo Authors. + * + * 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. + */ + +package com.intel.analytics.zoo.serving + +import com.intel.analytics.bigdl.tensor.Tensor +import com.intel.analytics.zoo.serving.utils.{ClusterServingHelper, SerParams} +import org.scalatest.{FlatSpec, Matchers} + +class InferenceSpec extends FlatSpec with Matchers { + "TF String input" should "work" in { +// val configPath = "/home/litchy/pro/analytics-zoo/config.yaml" + val str = "abc|dff|aoa" + val eleList = str.split("\\|") +// val helper = new ClusterServingHelper(configPath) +// helper.initArgs() +// val param = new SerParams(helper) +// val model = helper.loadInferenceModel() +// val res = model.doPredict(t) +// res + } + +} diff --git a/spark/dl/src/test/scala/com/intel/analytics/bigdl/serving/PreProcessingSpec.scala b/spark/dl/src/test/scala/com/intel/analytics/bigdl/serving/PreProcessingSpec.scala index c11bcda4b29..956ae21f26a 100644 --- a/spark/dl/src/test/scala/com/intel/analytics/bigdl/serving/PreProcessingSpec.scala +++ b/spark/dl/src/test/scala/com/intel/analytics/bigdl/serving/PreProcessingSpec.scala @@ -58,4 +58,12 @@ class PreProcessingSpec extends FlatSpec with Matchers { val a = pre.decodeTensor(info) a } + "decode string tensor" should "work" in { + val pre = new PreProcessing(null) + val str = "abc|dff|aoa" + val tensor = pre.decodeString(str) + assert(tensor.valueAt(1) == "abc") + assert(tensor.valueAt(2) == "dff") + assert(tensor.valueAt(3) == "aoa") + } }