Skip to content
Merged
Changes from 1 commit
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: 10 additions & 0 deletions juice/src/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,15 @@ impl<B: IBackend> Layer<B> {
} else {
format!("{}-{}", self.name, weight_id)
};

let display_name_bias = if !weight_name.is_empty() {
format!("{weight_name}-bias")
} else {
format!("{}-{}-bias", self.name, weight_id)
};

self.weights_display_names.push(display_name.clone());
self.weights_display_names.push(display_name_bias.clone());
// create name for registry
let registry_name = format!("SHARED_WEIGHT_{}", display_name);

Expand Down Expand Up @@ -925,6 +933,8 @@ impl<'a, B: IBackend> CapnpWrite<'a> for Layer<B> {
let names = self.learnable_weights_names();
let weights_data = self.learnable_weights_data();

assert_eq!(names.len(), weights_data.len(), "Not all layers are named");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert_eq!(names.len(), weights_data.len(), "Not all layers are named");
assert_eq!(names.len(), weights_data.len(), "All layers are named. qed");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to "All layers must be named".


for (i, (name, weight)) in names.iter().zip(weights_data).enumerate() {
let mut capnp_weight = weights.reborrow().get(i as u32);
capnp_weight.set_name(name);
Expand Down