Browse Source

feed_dict_tensor in BaseSession._run

tags/v0.1.0-Tensor
haiping008 6 years ago
parent
commit
5f595eb5eb
2 changed files with 22 additions and 1 deletions
  1. +20
    -1
      src/TensorFlowNET.Core/BaseSession.cs
  2. +2
    -0
      src/TensorFlowNET.Core/Tensor.cs

+ 20
- 1
src/TensorFlowNET.Core/BaseSession.cs View File

@@ -1,4 +1,5 @@
using System;
using NumSharp.Core;
using System;
using System.Collections.Generic;
using System.Text;

@@ -44,6 +45,24 @@ namespace Tensorflow

private unsafe byte[] _run(Tensor fetches, Dictionary<Tensor, object> feed_dict = null)
{
var feed_dict_tensor = new Dictionary<Tensor, NDArray>();

if (feed_dict != null)
{
NDArray np_val = null;
foreach (var feed in feed_dict)
{
switch (feed.Value)
{
case float value:
np_val = np.asarray(value);
break;
}

feed_dict_tensor[feed.Key] = np_val;
}
}
var status = new Status();

c_api.TF_SessionRun(_session,


+ 2
- 0
src/TensorFlowNET.Core/Tensor.cs View File

@@ -13,6 +13,8 @@ namespace Tensorflow
private DataType _dtype;
public DataType dtype => _dtype;

public string name;

public Tensor(Operation op, int value_index, DataType dtype)
{
_op = op;


Loading…
Cancel
Save