forked from SciSharp/TensorFlow.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMemoryFuncGraphTest.cs
More file actions
30 lines (28 loc) · 853 Bytes
/
MemoryFuncGraphTest.cs
File metadata and controls
30 lines (28 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using Tensorflow.NumPy;
using System;
using System.Collections.Generic;
using System.Text;
using Tensorflow.Functions;
using static Tensorflow.Binding;
namespace Tensorflow
{
class MemoryFuncGraphTest
{
public Action<int, int> ConcreteFunction
=> (epoch, iterate) =>
{
var func = new ConcreteFunction(Guid.NewGuid().ToString());
func.Enter();
var input = tf.placeholder(tf.float32);
var output = permutation(input);
func.ToGraph(input, output);
func.Exit();
};
Tensor permutation(Tensor tensor)
{
Shape shape = (8, 64, 64, 3);
var images = np.arange(shape.size).astype(np.float32).reshape(shape.dims);
return tf.constant(images);
}
}
}