Browse Source

_FetchHandler: Switched to NPTypeCode

tags/v0.12
Eli Belash 6 years ago
parent
commit
c876be4a79
1 changed files with 12 additions and 11 deletions
  1. +12
    -11
      src/TensorFlowNET.Core/Sessions/_FetchHandler.cs

+ 12
- 11
src/TensorFlowNET.Core/Sessions/_FetchHandler.cs View File

@@ -17,6 +17,7 @@
using NumSharp; using NumSharp;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using NumSharp.Backends;


namespace Tensorflow namespace Tensorflow
{ {
@@ -71,18 +72,18 @@ namespace Tensorflow
{ {
if(tensor_values.Length > 0) if(tensor_values.Length > 0)
{ {
switch (tensor_values[0].dtype.Name)
switch (tensor_values[0].typecode)
{ {
case "Int32":
case NPTypeCode.Int32:
full_values.Add(float.NaN); full_values.Add(float.NaN);
break; break;
case "Single":
case NPTypeCode.Single:
full_values.Add(float.NaN); full_values.Add(float.NaN);
break; break;
case "String":
case NPTypeCode.String:
full_values.Add(float.NaN); full_values.Add(float.NaN);
break; break;
case "Char":
case NPTypeCode.Char:
full_values.Add(float.NaN); full_values.Add(float.NaN);
break; break;
default: default:
@@ -100,21 +101,21 @@ namespace Tensorflow
j += 1; j += 1;
if (value.ndim == 0) if (value.ndim == 0)
{ {
switch (value.dtype.Name)
switch (value.typecode)
{ {
case "Int16":
case NPTypeCode.Int16:
full_values.Add(value.GetValue<short>(0)); full_values.Add(value.GetValue<short>(0));
break; break;
case "Int32":
case NPTypeCode.Int32:
full_values.Add(value.GetValue<int>(0)); full_values.Add(value.GetValue<int>(0));
break; break;
case "Int64":
case NPTypeCode.Int64:
full_values.Add(value.GetValue<long>(0)); full_values.Add(value.GetValue<long>(0));
break; break;
case "Single":
case NPTypeCode.Single:
full_values.Add(value.GetValue<float>(0)); full_values.Add(value.GetValue<float>(0));
break; break;
case "Double":
case NPTypeCode.Double:
full_values.Add(value.GetValue<double>(0)); full_values.Add(value.GetValue<double>(0));
break; break;
/*case "String": /*case "String":


Loading…
Cancel
Save