Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Resolve fixed-size array error #1281

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/TensorFlowNET.Keras/Engine/Functional.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ void ComputeTensorUsageCount()
var (nodes_in_decreasing_depth, layer_indices) = BuildMap(outputs);
var network_nodes = nodes_in_decreasing_depth
.Select(node => MakeNodeKey(node.Layer.Name, node.Layer.InboundNodes.IndexOf(node)))
.ToArray();
.ToList();

var nodes_depths = new Dictionary<INode, int>();
var layers_depths = new Dictionary<ILayer, int>();
Expand Down Expand Up @@ -221,7 +221,7 @@ void ComputeTensorUsageCount()
layers_depths[input_layer] = 0;
layer_indices[input_layer] = -1;
nodes_depths[input_layer.InboundNodes[0]] = 0;
network_nodes.add(MakeNodeKey(input_layer.Name, 0));
network_nodes.Add(MakeNodeKey(input_layer.Name, 0));
}
}

Expand All @@ -231,15 +231,15 @@ void ComputeTensorUsageCount()
{
if (!nodes_by_depth.ContainsKey(depth))
nodes_by_depth[depth] = new List<INode>();
nodes_by_depth[depth].append(node);
nodes_by_depth[depth].Add(node);
}

var layers_by_depth = new Dictionary<int, List<ILayer>>();
foreach (var (layer, depth) in enumerate(layers_depths))
{
if (!layers_by_depth.ContainsKey(depth))
layers_by_depth[depth] = new List<ILayer>();
layers_by_depth[depth].append(layer);
layers_by_depth[depth].Add(layer);
}

// Get sorted list of layer depths.
Expand All @@ -260,7 +260,7 @@ void ComputeTensorUsageCount()
// Get sorted list of node depths.
depth_keys = nodes_by_depth.Keys.OrderBy(x => x).Reverse();

return (network_nodes, nodes_by_depth, layers, layers_by_depth);
return (network_nodes.ToArray(), nodes_by_depth, layers, layers_by_depth);
}

string MakeNodeKey(string layer_name, int node_index)
Expand Down
Loading