using System;
using System.IO;
using Tizen;
+using Tizen.System;
using Tizen.MachineLearning.Inference;
namespace Tizen.MachineLearning.Inference.Tests {
private TensorsInfo _in_info;
private TensorsInfo _out_info;
+ private const string FeatureKey = "http://tizen.org/feature/machine_learning.inference";
+ private bool _isMachineLeanringInferenceSupported = false;
+
[SetUp]
public void Init()
{
LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for Tizen.MachineLearning.Inference TEST");
- _in_info = new TensorsInfo();
- _in_info.AddTensorInfo(TensorType.UInt8, new int[4] { 3, 224, 224, 1 });
+ Information.TryGetValue(FeatureKey, out _isMachineLeanringInferenceSupported);
+
+ if (_isMachineLeanringInferenceSupported)
+ {
+ _in_info = new TensorsInfo();
+ _in_info.AddTensorInfo(TensorType.UInt8, new int[4] { 3, 224, 224, 1 });
- _out_info = new TensorsInfo();
- _out_info.AddTensorInfo(TensorType.UInt8, new int[4] { 1001, 1, 1, 1 });
+ _out_info = new TensorsInfo();
+ _out_info.AddTensorInfo(TensorType.UInt8, new int[4] { 1001, 1, 1, 1 });
+ }
}
[TearDown]
{
LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for Tizen.MachineLearning.Inference TEST");
- _in_info.Dispose();
- _out_info.Dispose();
+ if (_isMachineLeanringInferenceSupported)
+ {
+ _in_info.Dispose();
+ _out_info.Dispose();
+ }
}
[Test]
[Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
public void SingleShot_INIT()
{
- /* TEST CODE */
Assert.IsTrue(File.Exists(_modelPath), "Cannot find the mobilenet_v1_1.0_224_quant.tflite file");
try
{
+ /* TEST CODE */
var single = new SingleShot(_modelPath, _in_info, _out_info);
Assert.IsInstanceOf<SingleShot>(single, "Should return SingleShot instance");
Assert.IsNotNull(single, "Failed to create SingleShot instance");
}
catch (Exception e)
{
- Assert.True(false, e.Message);
+ if (e is NotSupportedException)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else
+ {
+ Assert.True(false, e.Message);
+ }
}
}
{
try
{
+ /* TEST CODE */
var single = new SingleShot("Unknown_Path", _in_info, _out_info);
}
- catch (ArgumentException)
+ catch (Exception e)
{
- Assert.Pass("ArgumentException: passed!");
+ if (e is NotSupportedException)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else if (e is ArgumentException)
+ {
+ Assert.Pass("ArgumentException: passed!");
+ }
+ else
+ {
+ Assert.Fail("Unexpected Exception: failed");
+ }
}
}
Assert.IsInstanceOf<byte[]>(out_buffer_origin, "out_buffer_origin payload is not of the of the type byte[]");
Assert.IsNotNull(out_buffer_origin, "Fail to create the out_buffer_origin the type byte[] ");
- var single = new SingleShot(_modelPath, _in_info, _out_info);
- Assert.IsInstanceOf<SingleShot>(single, "Should return SingleShot instance");
- Assert.IsNotNull(single, "Failed to create SingleShot instance");
+ try
+ {
+ var single = new SingleShot(_modelPath, _in_info, _out_info);
+ Assert.IsInstanceOf<SingleShot>(single, "Should return SingleShot instance");
+ Assert.IsNotNull(single, "Failed to create SingleShot instance");
- var in_data = _in_info.GetTensorsData();
- Assert.IsInstanceOf<TensorsData>(in_data, "Should return TensorsData instance");
- Assert.IsNotNull(in_data, "Failed to create TensorsData instance");
+ var in_data = _in_info.GetTensorsData();
+ Assert.IsInstanceOf<TensorsData>(in_data, "Should return TensorsData instance");
+ Assert.IsNotNull(in_data, "Failed to create TensorsData instance");
- in_data.SetTensorData(0, in_buffer);
+ in_data.SetTensorData(0, in_buffer);
- /* TEST CODE */
- try
- {
+ /* TEST CODE */
var out_data = single.Invoke(in_data);
Assert.IsInstanceOf<TensorsData>(out_data, "Should return TensorsData instance");
Assert.IsNotNull(out_data, "Failed to create TensorsData instance");
var out_buffer = out_data.GetTensorData(0);
Assert.IsInstanceOf<byte[]>(out_buffer, "Should return byte[] instance");
Assert.IsNotNull(out_buffer, "Failed to create byte[] instance");
+
+ single.Dispose();
}
catch (Exception e)
{
- Assert.True(false, e.Message);
+ if (e is NotSupportedException)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else
+ {
+ Assert.True(false, e.Message);
+ }
}
-
- single.Dispose();
}
[Test]
{
Assert.IsTrue(File.Exists(_modelPath), "Cannot find the mobilenet_v1_1.0_224_quant.tflite file");
- var in_info = new TensorsInfo();
- Assert.IsInstanceOf<TensorsInfo>(in_info, "Should return TensorsInfo instance");
- Assert.IsNotNull(in_info, "Failed to create TensorsInfo instance");
+ try
+ {
+ var in_info = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(in_info, "Should return TensorsInfo instance");
+ Assert.IsNotNull(in_info, "Failed to create TensorsInfo instance");
- var in_buffer = new byte[10 * 1 * 1 * 1];
- Assert.IsInstanceOf<byte[]>(in_buffer, "in_buffer payload is not of the of the type byte[]");
- Assert.IsNotNull(in_buffer, "Fail to create the in_buffer the type byte[] ");
+ var in_buffer = new byte[10 * 1 * 1 * 1];
+ Assert.IsInstanceOf<byte[]>(in_buffer, "in_buffer payload is not of the of the type byte[]");
+ Assert.IsNotNull(in_buffer, "Fail to create the in_buffer the type byte[] ");
- in_info.AddTensorInfo(TensorType.UInt8, new int[4] { 10, 1, 1, 1 });
+ in_info.AddTensorInfo(TensorType.UInt8, new int[4] { 10, 1, 1, 1 });
- var in_data = _in_info.GetTensorsData();
- Assert.IsInstanceOf<TensorsData>(in_data, "Should return TensorsData instance");
- Assert.IsNotNull(in_data, "Fail to create the TensorsData instance");
+ var in_data = _in_info.GetTensorsData();
+ Assert.IsInstanceOf<TensorsData>(in_data, "Should return TensorsData instance");
+ Assert.IsNotNull(in_data, "Fail to create the TensorsData instance");
- in_data.SetTensorData(0, in_buffer);
+ in_data.SetTensorData(0, in_buffer);
- var single = new SingleShot(_modelPath, _in_info, _out_info);
- Assert.IsInstanceOf<SingleShot>(single, "Should return SingleShot instance");
- Assert.IsNotNull(single, "Failed to create SingleShot instance");
+ var single = new SingleShot(_modelPath, _in_info, _out_info);
+ Assert.IsInstanceOf<SingleShot>(single, "Should return SingleShot instance");
+ Assert.IsNotNull(single, "Failed to create SingleShot instance");
- /* TEST CODE */
- try
- {
+ /* TEST CODE */
var out_data = single.Invoke(in_data);
}
- catch (IOException)
+ catch (Exception e)
{
- Assert.Pass("IOException: passed!");
+ if (e is NotSupportedException)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else if (e is IOException)
+ {
+ Assert.Pass("IOException: passed!");
+ }
+ else
+ {
+ Assert.Fail("Unexpected Exception: failed");
+ }
}
}
}
using NUnit.Framework.TUnit;
using System;
using Tizen;
+using Tizen.System;
using Tizen.MachineLearning.Inference;
namespace Tizen.MachineLearning.Inference.Tests {
public class TensorsDataTests
{
private readonly string TAG = "Tizen.MachineLearning.Inference TCT";
- private TensorsInfo _tensorsInfo;
+ private TensorsInfo _tensorsInfo = null;
private int[] _in_dim;
+ private const string FeatureKey = "http://tizen.org/feature/machine_learning.inference";
+ private bool _isMachineLeanringInferenceSupported = false;
+
[SetUp]
public void Init()
{
LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for Tizen.MachineLearning.Inference TEST");
- _tensorsInfo = new TensorsInfo();
- _in_dim = new int[4] { 10, 1, 1, 1 };
+ Information.TryGetValue(FeatureKey, out _isMachineLeanringInferenceSupported);
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "#### MachineLeanringInferenceSupported: " + _isMachineLeanringInferenceSupported.ToString());
+
+ if (_isMachineLeanringInferenceSupported)
+ {
+ _tensorsInfo = new TensorsInfo();
+ _in_dim = new int[4] { 10, 1, 1, 1 };
- _tensorsInfo.AddTensorInfo(TensorType.UInt8, _in_dim);
+ _tensorsInfo.AddTensorInfo(TensorType.UInt8, _in_dim);
+ }
}
[TearDown]
{
LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for Tizen.MachineLearning.Inference TEST");
- _tensorsInfo.Dispose();
+ if (_isMachineLeanringInferenceSupported)
+ _tensorsInfo.Dispose();
}
[Test]
}
catch (Exception e)
{
- Assert.True(false, e.Message);
+ if ((e is NotSupportedException) || (e is NullReferenceException && _tensorsInfo == null))
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else
+ {
+ Assert.True(false, e.Message);
+ }
}
}
try
{
+ /* TEST CODE */
var tensorsData = _tensorsInfo.GetTensorsData();
Assert.IsInstanceOf<TensorsData>(tensorsData, "tensorsData payload is not of the of the TensorsData.");
Assert.IsNotNull(tensorsData, "Fail to create the tensorsData.");
tensorsData.SetTensorData(10, buffer_in);
}
- catch (ArgumentException)
+ catch (Exception e)
{
- Assert.Pass("ArgumentException: passed!");
+ if ((e is NotSupportedException) || (e is NullReferenceException && _tensorsInfo == null))
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else if (e is ArgumentException)
+ {
+ Assert.Pass("ArgumentException: passed!");
+ }
+ else
+ {
+ Assert.Fail("Unexpected Exception: failed");
+ }
}
}
Assert.IsInstanceOf<byte[]>(buffer_in, "buffer_in is not the type of byte[].");
Assert.IsNotNull(buffer_in, "Fail to create buffer_in.");
- var tensorsData = _tensorsInfo.GetTensorsData();
- Assert.IsInstanceOf<TensorsData>(tensorsData, "tensorsData is not the type of TensorsData.");
- Assert.IsNotNull(tensorsData, "Fail to create tensorsData.");
+ try
+ {
+ var tensorsData = _tensorsInfo.GetTensorsData();
+ Assert.IsInstanceOf<TensorsData>(tensorsData, "tensorsData is not the type of TensorsData.");
+ Assert.IsNotNull(tensorsData, "Fail to create tensorsData.");
+
+ tensorsData.SetTensorData(0, buffer_in);
- tensorsData.SetTensorData(0, buffer_in);
+ /* TEST CODE */
+ var buffer_out = tensorsData.GetTensorData(0);
+ Assert.IsInstanceOf<byte[]>(buffer_out, "buffer_out is not the type of byte[].");
+ Assert.IsNotNull(buffer_out, "Fail to create buffer_out.");
- /* TEST CODE */
- var buffer_out = tensorsData.GetTensorData(0);
- Assert.IsInstanceOf<byte[]>(buffer_out, "buffer_out is not the type of byte[].");
- Assert.IsNotNull(buffer_out, "Fail to create buffer_out.");
+ Assert.IsTrue(buffer_in.Length == buffer_out.Length, "The length of buffer_out payload is different from buffer_in.");
- Assert.IsTrue(buffer_in.Length == buffer_out.Length, "The length of buffer_out payload is different from buffer_in.");
+ for (int i = 0; i < buffer_out.Length; ++i)
+ {
+ Assert.IsTrue(buffer_in[i] == buffer_out[i], "The value of buffer_in is different from that of buffer_out");
+ }
- for (int i = 0; i < buffer_out.Length; ++i)
+ tensorsData.Dispose();
+ }
+ catch (Exception e)
{
- Assert.IsTrue(buffer_in[i] == buffer_out[i], "The value of buffer_in is different from that of buffer_out");
+ if ((e is NotSupportedException) || (e is NullReferenceException && _tensorsInfo == null))
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else
+ {
+ Assert.True(false, e.Message);
+ }
}
-
- tensorsData.Dispose();
}
[Test]
Assert.IsInstanceOf<byte[]>(buffer_in, "buffer_in is not the type of byte[].");
Assert.IsNotNull(buffer_in, "Fail to create buffer_in.");
- var tensorsData = _tensorsInfo.GetTensorsData();
- Assert.IsInstanceOf<TensorsData>(tensorsData, "tensorsData is not the type of TensorsData.");
- Assert.IsNotNull(tensorsData, "Fail to create tensorsData.");
-
- tensorsData.SetTensorData(0, buffer_in);
-
try
{
+ var tensorsData = _tensorsInfo.GetTensorsData();
+ Assert.IsInstanceOf<TensorsData>(tensorsData, "tensorsData is not the type of TensorsData.");
+ Assert.IsNotNull(tensorsData, "Fail to create tensorsData.");
+
+ tensorsData.SetTensorData(0, buffer_in);
+
/* TEST CODE */
var buffer_out = tensorsData.GetTensorData(100);
}
- catch (ArgumentException)
+ catch (Exception e)
{
- Assert.Pass("ArgumentException: passed!");
+ if ((e is NotSupportedException) || (e is NullReferenceException && _tensorsInfo == null))
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else if (e is ArgumentException)
+ {
+ Assert.Pass("ArgumentException: passed!");
+ }
+ else
+ {
+ Assert.Fail("Unexpected Exception: failed");
+ }
}
}
Assert.IsInstanceOf<byte[]>(buffer_in, "buffer_in is not the type of byte[].");
Assert.IsNotNull(buffer_in, "Fail to create buffer_in.");
- var tensorsData = _tensorsInfo.GetTensorsData();
- Assert.IsInstanceOf<TensorsData>(tensorsData, "tensorsData is not the type of TensorsData.");
- Assert.IsNotNull(tensorsData, "Fail to create tensorsData.");
+ try
+ {
+ var tensorsData = _tensorsInfo.GetTensorsData();
+ Assert.IsInstanceOf<TensorsData>(tensorsData, "tensorsData is not the type of TensorsData.");
+ Assert.IsNotNull(tensorsData, "Fail to create tensorsData.");
- tensorsData.SetTensorData(0, buffer_in);
+ tensorsData.SetTensorData(0, buffer_in);
- /* TEST CODE */
- Assert.IsTrue(1 == tensorsData.Count, "The number of Tensor in TensorsData is different from the origin.");
+ /* TEST CODE */
+ Assert.IsTrue(1 == tensorsData.Count, "The number of Tensor in TensorsData is different from the origin.");
+ }
+ catch (Exception e)
+ {
+ if ((e is NotSupportedException) || (e is NullReferenceException && _tensorsInfo == null))
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else
+ {
+ Assert.True(false, e.Message);
+ }
+ }
}
}
}
using NUnit.Framework.TUnit;
using System;
using Tizen;
+using Tizen.System;
using Tizen.MachineLearning.Inference;
namespace Tizen.MachineLearning.Inference.Tests {
{
private readonly string TAG = "Tizen.MachineLearning.Inference TCT";
+ private const string FeatureKey = "http://tizen.org/feature/machine_learning.inference";
+ private bool _isMachineLeanringInferenceSupported = false;
+
[SetUp]
public void Init()
{
LogUtils.Write(LogUtils.DEBUG , LogUtils.TAG , "Preconditions for Tizen.MachineLearning.Inference TEST");
+
+ Information.TryGetValue(FeatureKey, out _isMachineLeanringInferenceSupported);
}
[TearDown]
}
catch (Exception e)
{
- Assert.True(false, e.Message);
+ if (e is NotSupportedException)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else
+ {
+ Assert.True(false, e.Message);
+ }
}
}
+
[Test]
[Category("P1")]
[Description("Add TensorInfo into TensorsInfo with the input dimension information")]
Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
- var tensorsInfo = new TensorsInfo();
- Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
- Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
-
try
{
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
/* TEST CODE */
tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
- }
- catch (Exception e)
- {
- Assert.True(false, e.Message);
- }
- Assert.IsTrue(tensorsInfo.GetTensorType(0) == TensorType.UInt8, "The TensorType is not TensorType.UInt8.");
+ Assert.IsTrue(tensorsInfo.GetTensorType(0) == TensorType.UInt8, "The TensorType is not TensorType.UInt8.");
- var in_res = tensorsInfo.GetDimension(0);
- Assert.IsInstanceOf<int[]>(in_res, "Should return int[] instance");
- Assert.IsNotNull(in_res, "Failed to create in_res instance");
+ var in_res = tensorsInfo.GetDimension(0);
+ Assert.IsInstanceOf<int[]>(in_res, "Should return int[] instance");
+ Assert.IsNotNull(in_res, "Failed to create in_res instance");
- for (int i = 0; i < 4; ++i)
+ for (int i = 0; i < 4; ++i)
+ {
+ Assert.IsTrue(in_dim[i] == in_res[i], "The dimension of Input Tensor is different from the origin.");
+ }
+ }
+ catch (Exception e)
{
- Assert.IsTrue(in_dim[i] == in_res[i], "The dimension of Input Tensor is different from the origin.");
+ if (e is NotSupportedException)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else
+ {
+ Assert.True(false, e.Message);
+ }
}
}
var in_dim = new int[4] { 3, 224, 224, 1 };
Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
-
- var tensorsInfo = new TensorsInfo();
- Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
- Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
-
string TensorName = "InputTensorName";
try
{
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
/* TEST CODE */
tensorsInfo.AddTensorInfo(TensorName, TensorType.UInt8, in_dim);
- }
- catch (Exception e)
- {
- Assert.True(false, e.Message);
- }
- /* Type checking */
- Assert.IsTrue(tensorsInfo.GetTensorType(0) == TensorType.UInt8, "The TensorType is not TensorType.UInt8.");
+ /* Type checking */
+ Assert.IsTrue(tensorsInfo.GetTensorType(0) == TensorType.UInt8, "The TensorType is not TensorType.UInt8.");
- /* Dimension checking */
- var in_res = tensorsInfo.GetDimension(0);
- Assert.IsInstanceOf<int[]>(in_res, "Should return int[] instance");
- Assert.IsNotNull(in_res, "Failed to create in_res instance");
+ /* Dimension checking */
+ var in_res = tensorsInfo.GetDimension(0);
+ Assert.IsInstanceOf<int[]>(in_res, "Should return int[] instance");
+ Assert.IsNotNull(in_res, "Failed to create in_res instance");
- for (int i = 0; i < 4; ++i)
+ for (int i = 0; i < 4; ++i)
+ {
+ Assert.IsTrue(in_dim[i] == in_res[i], "The dimension of Input Tensor is different from the origin.");
+ }
+
+ /* Name checking */
+ Assert.IsTrue(tensorsInfo.GetTensorName(0) == TensorName, "The name of Input Tensor is different from the origin.");
+ }
+ catch (Exception e)
{
- Assert.IsTrue(in_dim[i] == in_res[i], "The dimension of Input Tensor is different from the origin.");
+ if (e is NotSupportedException)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else
+ {
+ Assert.True(false, e.Message);
+ }
}
-
- /* Name checking */
- Assert.IsTrue(tensorsInfo.GetTensorName(0) == TensorName, "The name of Input Tensor is different from the origin.");
}
[Test]
Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
- var tensorsInfo = new TensorsInfo();
- Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
- Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
-
try
{
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
/* TEST CODE */
- for (int i = 0; i < 17; ++i) {
+ for (int i = 0; i < 17; ++i)
+ {
tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
}
Assert.True(false, "DO NOT COME HERE since the limit of tensor size is 16");
}
- catch (IndexOutOfRangeException)
+ catch (Exception e)
{
- Assert.Pass("IndexOutOfRangeException: passed!");
+ if (e is NotSupportedException)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else if (e is IndexOutOfRangeException)
+ {
+ Assert.Pass("IndexOutOfRangeException: passed!");
+ }
+ else
+ {
+ Assert.True(false, e.Message);
+ }
}
}
[Property("COVPARAM", "string, Tizen.MachineLearning.Inference.TensorType, int[]")]
public void AddTensorInfo_CHECK_IndexOutOfRangeException_WITH_NAME()
{
+ string TensorName = "InputTensorName";
var in_dim = new int[4] { 3, 224, 224, 1 };
Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
- var tensorsInfo = new TensorsInfo();
- Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
- Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
-
- string TensorName = "InputTensorName";
-
try
{
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
/* TEST CODE */
for (int i = 0; i < 17; ++i)
{
}
Assert.True(false, "DO NOT COME HERE since the limit of tensor size is 16");
}
- catch (IndexOutOfRangeException)
+ catch (Exception e)
{
- Assert.Pass("IndexOutOfRangeException: passed!");
+ if (e is NotSupportedException)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else if (e is IndexOutOfRangeException)
+ {
+ Assert.Pass("IndexOutOfRangeException: passed!");
+ }
+ else
+ {
+ Assert.True(false, e.Message);
+ }
}
}
[Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
public void GetTensorName_RETURN_VALUE()
{
+ string inTensorName = "InputTensorName";
var in_dim = new int[4] { 3, 224, 224, 1 };
Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
- var tensorsInfo = new TensorsInfo();
- Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
- Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+ try
+ {
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
- string inTensorName = "InputTensorName";
- tensorsInfo.AddTensorInfo(inTensorName, TensorType.UInt8, in_dim);
+ tensorsInfo.AddTensorInfo(inTensorName, TensorType.UInt8, in_dim);
- /* TEST CODE */
- string outTensorName = tensorsInfo.GetTensorName(0);
- Assert.IsTrue(inTensorName == outTensorName, "The TensorInfo name is different from the origin.");
+ /* TEST CODE */
+ string outTensorName = tensorsInfo.GetTensorName(0);
+ Assert.IsTrue(inTensorName == outTensorName, "The TensorInfo name is different from the origin.");
+ }
+ catch (Exception e)
+ {
+ if (e is NotSupportedException)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else
+ {
+ Assert.True(false, e.Message);
+ }
+ }
}
[Test]
[Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
public void GetTensorName_CHECK_IndexOutOfRangeException()
{
+ string inTensorName = "InputTensorName";
var in_dim = new int[4] { 3, 224, 224, 1 };
Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
- var tensorsInfo = new TensorsInfo();
- Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
- Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
-
- string inTensorName = "InputTensorName";
- tensorsInfo.AddTensorInfo(inTensorName, TensorType.UInt8, in_dim);
-
try
{
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ tensorsInfo.AddTensorInfo(inTensorName, TensorType.UInt8, in_dim);
+
+ /* TEST CODE */
string outTensorName = tensorsInfo.GetTensorName(100);
}
- catch (IndexOutOfRangeException)
+ catch (Exception e)
{
- Assert.Pass("IndexOutOfRangeException: passed!");
+ if (e is NotSupportedException)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else if (e is IndexOutOfRangeException)
+ {
+ Assert.Pass("IndexOutOfRangeException: passed!");
+ }
+ else
+ {
+ Assert.True(false, e.Message);
+ }
}
}
[Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
public void SetTensorName_RETURN_VALUE()
{
+ string inTensorName = "InputTensorName";
var in_dim = new int[4] { 3, 224, 224, 1 };
Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
- var tensorsInfo = new TensorsInfo();
- Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
- Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+ try
+ {
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
- string inTensorName = "InputTensorName";
- tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
- /* TEST CODE */
- tensorsInfo.SetTensorName(0, inTensorName);
+ /* TEST CODE */
+ tensorsInfo.SetTensorName(0, inTensorName);
- string outTensorName = tensorsInfo.GetTensorName(0);
- Assert.IsTrue(inTensorName == outTensorName, "The TensorInfo name is different from the origin.");
+ string outTensorName = tensorsInfo.GetTensorName(0);
+ Assert.IsTrue(inTensorName == outTensorName, "The TensorInfo name is different from the origin.");
+ }
+ catch (Exception e)
+ {
+ if (e is NotSupportedException)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else
+ {
+ Assert.True(false, e.Message);
+ }
+ }
}
[Test]
[Property("AUTHOR", "Sangjung Woo, sangjung.woo@samsung.com")]
public void SetTensorName_CHECK_IndexOutOfRangeException()
{
+ string inTensorName = "InputTensorName";
var in_dim = new int[4] { 3, 224, 224, 1 };
Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
- var tensorsInfo = new TensorsInfo();
- Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
- Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
-
try
{
- string inTensorName = "InputTensorName";
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
/* TEST CODE */
tensorsInfo.SetTensorName(100, inTensorName);
}
- catch (IndexOutOfRangeException)
+ catch (Exception e)
{
- Assert.Pass("IndexOutOfRangeException: passed!");
+ if (e is NotSupportedException)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else if (e is IndexOutOfRangeException)
+ {
+ Assert.Pass("IndexOutOfRangeException: passed!");
+ }
+ else
+ {
+ Assert.True(false, e.Message);
+ }
}
}
Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
- var tensorsInfo = new TensorsInfo();
- Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
- Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
-
try
{
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
/* TEST CODE */
tensorsInfo.SetTensorName(0, null);
}
- catch (ArgumentException)
+ catch (Exception e)
{
- Assert.Pass("ArgumentException: passed!");
+ if (e is NotSupportedException)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else if (e is ArgumentException)
+ {
+ Assert.Pass("ArgumentException: passed!");
+ }
+ else
+ {
+ Assert.True(false, e.Message);
+ }
}
}
Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
- var tensorsInfo = new TensorsInfo();
- Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
- Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+ try
+ {
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
- tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
- /* TEST CODE */
- tensorsInfo.SetTensorType(0, TensorType.Float32);
- Assert.IsTrue(tensorsInfo.GetTensorType(0) == TensorType.Float32, "The TensorType is not TensorType.Float32.");
+ /* TEST CODE */
+ tensorsInfo.SetTensorType(0, TensorType.Float32);
+ Assert.IsTrue(tensorsInfo.GetTensorType(0) == TensorType.Float32, "The TensorType is not TensorType.Float32.");
+ }
+ catch (Exception e)
+ {
+ if (e is NotSupportedException)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else
+ {
+ Assert.True(false, e.Message);
+ }
+ }
}
[Test]
Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
- var tensorsInfo = new TensorsInfo();
- Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
- Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
-
- tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
-
try
{
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+
+ /* TEST CODE */
tensorsInfo.SetTensorType(100, TensorType.Float32);
}
- catch (IndexOutOfRangeException)
+ catch (Exception e)
{
- Assert.Pass("IndexOutOfRangeException: passed!");
+ if (e is NotSupportedException)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else if (e is IndexOutOfRangeException)
+ {
+ Assert.Pass("IndexOutOfRangeException: passed!");
+ }
+ else
+ {
+ Assert.True(false, e.Message);
+ }
}
}
Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
- var tensorsInfo = new TensorsInfo();
- Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
- Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
-
- foreach (TensorType type in Enum.GetValues(typeof(TensorType)))
+ try
{
- tensorsInfo.AddTensorInfo(type, in_dim);
- }
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ foreach (TensorType type in Enum.GetValues(typeof(TensorType)))
+ {
+ tensorsInfo.AddTensorInfo(type, in_dim);
+ }
- int i = 0;
- foreach (TensorType type in Enum.GetValues(typeof(TensorType)))
+ int i = 0;
+ foreach (TensorType type in Enum.GetValues(typeof(TensorType)))
+ {
+ /* TEST CODE */
+ Assert.IsTrue(tensorsInfo.GetTensorType(i++) == type, "The TensorType is different from the origin.");
+ }
+ }
+ catch (Exception e)
{
- /* TEST CODE */
- Assert.IsTrue(tensorsInfo.GetTensorType(i++) == type, "The TensorType is different from the origin.");
- }
-
- /*
- tensorsInfo.AddTensorInfo(TensorType.Int32, in_dim);
- tensorsInfo.AddTensorInfo(TensorType.UInt32, in_dim);
- tensorsInfo.AddTensorInfo(TensorType.Int16, in_dim);
- tensorsInfo.AddTensorInfo(TensorType.UInt16, in_dim);
- tensorsInfo.AddTensorInfo(TensorType.Int8, in_dim);
- tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
- tensorsInfo.AddTensorInfo(TensorType.Float64, in_dim);
- tensorsInfo.AddTensorInfo(TensorType.Float32, in_dim);
- tensorsInfo.AddTensorInfo(TensorType.Int64, in_dim);
- tensorsInfo.AddTensorInfo(TensorType.UInt64, in_dim);
-
- Assert.IsTrue(tensorsInfo.GetTensorType(0) == TensorType.Int32, "The TensorType is not TensorType.UInt8.");
- */
+ if (e is NotSupportedException)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else
+ {
+ Assert.True(false, e.Message);
+ }
+ }
}
[Test]
Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
- var tensorsInfo = new TensorsInfo();
- Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
- Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
-
- tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
-
try
{
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+
+ /* TEST CODE */
TensorType type = tensorsInfo.GetTensorType(100);
}
- catch (IndexOutOfRangeException)
+ catch (Exception e)
{
- Assert.Pass("IndexOutOfRangeException: passed!");
+ if (e is NotSupportedException)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else if (e is IndexOutOfRangeException)
+ {
+ Assert.Pass("IndexOutOfRangeException: passed!");
+ }
+ else
+ {
+ Assert.True(false, e.Message);
+ }
}
}
Assert.IsInstanceOf<int[]>(in_new_dim, "Should return int[] instance");
Assert.IsNotNull(in_new_dim, "Failed to create in_dim instance");
- var tensorsInfo = new TensorsInfo();
- Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
- Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+ try
+ {
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
- tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
- /* TEST CODE */
- tensorsInfo.SetDimension(0, in_new_dim);
- var in_res = tensorsInfo.GetDimension(0);
- Assert.IsInstanceOf<int[]>(in_res, "Should return int[] instance");
- Assert.IsNotNull(in_res, "Failed to create in_dim instance");
+ /* TEST CODE */
+ tensorsInfo.SetDimension(0, in_new_dim);
+ var in_res = tensorsInfo.GetDimension(0);
+ Assert.IsInstanceOf<int[]>(in_res, "Should return int[] instance");
+ Assert.IsNotNull(in_res, "Failed to create in_dim instance");
- for (int i = 0; i < 4; ++i)
+ for (int i = 0; i < 4; ++i)
+ {
+ Assert.IsTrue(in_new_dim[i] == in_res[i], "The dimension of Input Tensor is different from the origin.");
+ }
+ }
+ catch (Exception e)
{
- Assert.IsTrue(in_new_dim[i] == in_res[i], "The dimension of Input Tensor is different from the origin.");
+ if (e is NotSupportedException)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else
+ {
+ Assert.True(false, e.Message);
+ }
}
}
Assert.IsInstanceOf<int[]>(in_new_dim, "Should return int[] instance");
Assert.IsNotNull(in_new_dim, "Failed to create in_dim instance");
- var tensorsInfo = new TensorsInfo();
- Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
- Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
-
- tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
-
try
{
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+
+ /* TEST CODE */
tensorsInfo.SetDimension(100, in_new_dim);
}
- catch (IndexOutOfRangeException)
+ catch (Exception e)
{
- Assert.Pass("IndexOutOfRangeException: passed!");
+ if (e is NotSupportedException)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else if (e is IndexOutOfRangeException)
+ {
+ Assert.Pass("IndexOutOfRangeException: passed!");
+ }
+ else
+ {
+ Assert.True(false, e.Message);
+ }
}
}
Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
- var tensorsInfo = new TensorsInfo();
- Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
- Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
-
- tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
-
try
{
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+
+ /* TEST CODE */
tensorsInfo.SetDimension(0, null);
}
- catch (ArgumentException)
+ catch (Exception e)
{
- Assert.Pass("ArgumentException: passed!");
+ if (e is NotSupportedException)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else if (e is ArgumentException)
+ {
+ Assert.Pass("ArgumentException: passed!");
+ }
+ else
+ {
+ Assert.True(false, e.Message);
+ }
}
}
Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
- var tensorsInfo = new TensorsInfo();
- Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
- Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+ try
+ {
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
- tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
- /* TEST CODE */
- int[] in_res = tensorsInfo.GetDimension(0);
- for (int i = 0; i < 4; ++i)
+ /* TEST CODE */
+ int[] in_res = tensorsInfo.GetDimension(0);
+ for (int i = 0; i < 4; ++i)
+ {
+ Assert.IsTrue(in_dim[i] == in_res[i], "The dimension of Input Tensor is different from the origin.");
+ }
+ }
+ catch (Exception e)
{
- Assert.IsTrue(in_dim[i] == in_res[i], "The dimension of Input Tensor is different from the origin.");
+ if (e is NotSupportedException)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else
+ {
+ Assert.True(false, e.Message);
+ }
}
}
Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
- var tensorsInfo = new TensorsInfo();
- Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
- Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
-
- tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
-
try
{
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+
+ /* TEST CODE */
var in_res = tensorsInfo.GetDimension(100);
}
- catch (IndexOutOfRangeException)
+ catch (Exception e)
{
- Assert.Pass("IndexOutOfRangeException: passed!");
+ if (e is NotSupportedException)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else if (e is IndexOutOfRangeException)
+ {
+ Assert.Pass("IndexOutOfRangeException: passed!");
+ }
+ else
+ {
+ Assert.True(false, e.Message);
+ }
}
}
Assert.IsInstanceOf<byte[]>(buffer_in, "Should return byte[] instance");
Assert.IsNotNull(buffer_in, "Failed to create in_dim instance");
- var tensorsInfo = new TensorsInfo();
- Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
- Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
+ try
+ {
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
- tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
- /* TEST CODE */
- var tensorsData = tensorsInfo.GetTensorsData();
- Assert.IsInstanceOf<TensorsData>(tensorsData, "Should return TensorsData instance");
- Assert.IsNotNull(tensorsData, "Failed to create TensorsData instance");
+ /* TEST CODE */
+ var tensorsData = tensorsInfo.GetTensorsData();
+ Assert.IsInstanceOf<TensorsData>(tensorsData, "Should return TensorsData instance");
+ Assert.IsNotNull(tensorsData, "Failed to create TensorsData instance");
- tensorsData.SetTensorData(0, buffer_in);
+ tensorsData.SetTensorData(0, buffer_in);
- var buffer_out = tensorsData.GetTensorData(0);
- Assert.IsInstanceOf<byte[]>(buffer_out, "buffer_out is not the type of byte[].");
- Assert.IsNotNull(buffer_out, "Fail to create buffer_out.");
+ var buffer_out = tensorsData.GetTensorData(0);
+ Assert.IsInstanceOf<byte[]>(buffer_out, "buffer_out is not the type of byte[].");
+ Assert.IsNotNull(buffer_out, "Fail to create buffer_out.");
- Assert.IsTrue(buffer_in.Length == buffer_out.Length, "The length of buffer_out payload is different from buffer_in.");
- for (int i = 0; i < buffer_out.Length; ++i)
+ Assert.IsTrue(buffer_in.Length == buffer_out.Length, "The length of buffer_out payload is different from buffer_in.");
+ for (int i = 0; i < buffer_out.Length; ++i)
+ {
+ Assert.IsTrue(buffer_in[i] == buffer_out[i], "The value of buffer_in is different from that of buffer_out");
+ }
+ }
+ catch (Exception e)
{
- Assert.IsTrue(buffer_in[i] == buffer_out[i], "The value of buffer_in is different from that of buffer_out");
+ if (e is NotSupportedException)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else
+ {
+ Assert.True(false, e.Message);
+ }
}
}
Assert.IsInstanceOf<int[]>(in_dim, "Should return int[] instance");
Assert.IsNotNull(in_dim, "Failed to create in_dim instance");
- var tensorsInfo = new TensorsInfo();
- Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
- Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
-
- tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+ try
+ {
+ var tensorsInfo = new TensorsInfo();
+ Assert.IsInstanceOf<TensorsInfo>(tensorsInfo, "Should return TensorsInfo instance");
+ Assert.IsNotNull(tensorsInfo, "Failed to create tensorsInfo instance");
- Assert.IsTrue(1 == tensorsInfo.Count, "The count of TensorsInfo should be 1.");
+ /* TEST CODE */
+ tensorsInfo.AddTensorInfo(TensorType.UInt8, in_dim);
+ Assert.IsTrue(1 == tensorsInfo.Count, "The count of TensorsInfo should be 1.");
+ }
+ catch (Exception e)
+ {
+ if (e is NotSupportedException)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "NotSupportedException occurs");
+ Assert.IsTrue(_isMachineLeanringInferenceSupported == false, "Invalid NotSupportedException");
+ }
+ else
+ {
+ Assert.True(false, e.Message);
+ }
+ }
}
}
}