forked from SciSharp/TensorFlow.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModel.Build.cs
More file actions
31 lines (25 loc) · 736 Bytes
/
Model.Build.cs
File metadata and controls
31 lines (25 loc) · 736 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.Linq;
using Tensorflow.Graphs;
using static Tensorflow.Binding;
using static Tensorflow.KerasApi;
namespace Tensorflow.Keras.Engine
{
public partial class Model
{
public override void build(Shape input_shape)
{
if (this is Functional || this is Sequential)
{
base.build(input_shape);
return;
}
var graph = tf.executing_eagerly() ? new FuncGraph("build_graph") : keras.backend.get_graph();
graph.as_default();
var x = tf.placeholder(DType, input_shape);
Call(x, training: false);
graph.Exit();
base.build(input_shape);
}
}
}