forked from SciSharp/TensorFlow.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleRnnTest.cs
More file actions
31 lines (28 loc) · 934 Bytes
/
SimpleRnnTest.cs
File metadata and controls
31 lines (28 loc) · 934 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
31
using System;
using System.Collections.Generic;
using System.Text;
using Tensorflow.Keras;
using Tensorflow.NumPy;
using static Tensorflow.Binding;
using static Tensorflow.KerasApi;
namespace Tensorflow
{
public class SimpleRnnTest
{
public void Run()
{
tf.keras = new KerasInterface();
var inputs = np.random.random((32, 10, 8)).astype(np.float32);
var simple_rnn = tf.keras.layers.SimpleRNN(4);
var output = simple_rnn.Apply(inputs); // The output has shape `[32, 4]`.
if (output.shape == (32, 4))
{
}
/*simple_rnn = tf.keras.layers.SimpleRNN(
4, return_sequences = True, return_state = True)
# whole_sequence_output has shape `[32, 10, 4]`.
# final_state has shape `[32, 4]`.
whole_sequence_output, final_state = simple_rnn(inputs)*/
}
}
}