@@ -16,6 +16,18 @@ namespace Tensorflow | |||||
return tf.Graph(); | return tf.Graph(); | ||||
} | } | ||||
public static Tensor convert_to_tensor() | |||||
{ | |||||
return internal_convert_to_tensor(); | |||||
} | |||||
private static Tensor internal_convert_to_tensor() | |||||
{ | |||||
return null; | |||||
} | |||||
public static unsafe IntPtr _create_c_op(Graph graph, NodeDef node_def, List<Tensor> inputs) | public static unsafe IntPtr _create_c_op(Graph graph, NodeDef node_def, List<Tensor> inputs) | ||||
{ | { | ||||
var op_desc = c_api.TF_NewOperation(graph.Handle, node_def.Op, node_def.Name); | var op_desc = c_api.TF_NewOperation(graph.Handle, node_def.Op, node_def.Name); | ||||
@@ -0,0 +1,24 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace Tensorflow | |||||
{ | |||||
public class RefVariable : Variable | |||||
{ | |||||
public bool _in_graph_mode = true; | |||||
public RefVariable(object initial_value, | |||||
TF_DataType trainable, | |||||
bool validate_shape = true) : | |||||
base(initial_value, trainable, validate_shape) | |||||
{ | |||||
} | |||||
private void _init_from_args() | |||||
{ | |||||
} | |||||
} | |||||
} |
@@ -4,7 +4,21 @@ using System.Text; | |||||
namespace Tensorflow | namespace Tensorflow | ||||
{ | { | ||||
/// <summary> | |||||
/// A variable maintains state in the graph across calls to `run()`. You add a | |||||
/// variable to the graph by constructing an instance of the class `Variable`. | |||||
/// | |||||
/// The `Variable()` constructor requires an initial value for the variable, | |||||
/// which can be a `Tensor` of any type and shape. The initial value defines the | |||||
/// type and shape of the variable. After construction, the type and shape of | |||||
/// the variable are fixed. The value can be changed using one of the assign methods. | |||||
/// https://tensorflow.org/guide/variables | |||||
/// </summary> | |||||
public class Variable | public class Variable | ||||
{ | { | ||||
public Variable(object initial_value, TF_DataType trainable, bool validate_shape = true) | |||||
{ | |||||
} | |||||
} | } | ||||
} | } |
@@ -11,11 +11,17 @@ namespace Tensorflow | |||||
public static class tf | public static class tf | ||||
{ | { | ||||
public static TF_DataType float32 = TF_DataType.TF_FLOAT; | public static TF_DataType float32 = TF_DataType.TF_FLOAT; | ||||
public static TF_DataType chars = TF_DataType.TF_STRING; | |||||
public static Context context = new Context(); | public static Context context = new Context(); | ||||
public static Graph g = new Graph(c_api.TF_NewGraph()); | public static Graph g = new Graph(c_api.TF_NewGraph()); | ||||
public static object Variable<T>(T data, TF_DataType dtype) | |||||
{ | |||||
return new Variable(null, TF_DataType.DtInvalid); | |||||
} | |||||
public static unsafe Tensor add(Tensor a, Tensor b) | public static unsafe Tensor add(Tensor a, Tensor b) | ||||
{ | { | ||||
return gen_math_ops.add(a, b); | return gen_math_ops.add(a, b); | ||||
@@ -0,0 +1,17 @@ | |||||
using Microsoft.VisualStudio.TestTools.UnitTesting; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using Tensorflow; | |||||
namespace TensorFlowNET.UnitTest | |||||
{ | |||||
[TestClass] | |||||
public class VariableTest | |||||
{ | |||||
public void Creating() | |||||
{ | |||||
var mammal = tf.Variable("Elephant", tf.chars); | |||||
} | |||||
} | |||||
} |