forked from SciSharp/TensorFlow.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLayer.Serialize.cs
More file actions
32 lines (26 loc) · 1.16 KB
/
Copy pathLayer.Serialize.cs
File metadata and controls
32 lines (26 loc) · 1.16 KB
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
32
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Tensorflow.Keras.Saving.SavedModel;
using Tensorflow.Train;
namespace Tensorflow.Keras.Engine;
public abstract partial class Layer
{
public virtual SavedModelSaver TrackableSavedModelSaver => new LayerSavedModelSaver(this);
public override string ObjectIdentifier => TrackableSavedModelSaver.ObjectIdentifier;
public string GetTrackingMetadata() => TrackableSavedModelSaver.TrackingMetadata;
public override IDictionary<string, Trackable> _trackable_children(SaveType save_type = SaveType.CHECKPOINT, IDictionary<string, IDictionary<Trackable, ISerializedAttributes>>? cache = null)
{
IDictionary<string, Trackable> children;
if (save_type == SaveType.SAVEDMODEL)
{
Debug.Assert(cache is not null);
children = TrackableSavedModelSaver.trackable_children(cache);
}
else
{
children = new Dictionary<string, Trackable>();
}
return children.Concat(base._trackable_children(save_type, cache)).GroupBy(x => x.Key).Select(g => g.First()).ToDictionary(x => x.Key, x => x.Value);
}
}