Skip to content
Open
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
8 changes: 7 additions & 1 deletion bindsnet/network/monitors.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,13 @@ def get(self, var: str) -> torch.Tensor:
if self.clean:
return_logs = torch.empty(0, device=self.device)
else:
return_logs = torch.cat(self.recording[var], 0)
# If the actual run length is shorter than the preallocated time,
# some placeholders remain and break torch.cat, so we drop them.
entries = [e for e in self.recording[var] if torch.is_tensor(e)]
if len(entries) == 0:
return_logs = torch.empty(0, device=self.device)
else:
return_logs = torch.cat(entries, 0)
if self.time is None:
self.recording[var] = []
return return_logs
Expand Down