Skip to content

Instantly share code, notes, and snippets.

@ilkarman
Created June 30, 2017 10:09
Show Gist options
  • Save ilkarman/3a2cb478a39b7a53d4a2ad2a2ca804f7 to your computer and use it in GitHub Desktop.
Save ilkarman/3a2cb478a39b7a53d4a2ad2a2ca804f7 to your computer and use it in GitHub Desktop.
Generate square of feature maps for nnet
square_stack_lst_of_matricies <- function(lst)
{
sqr_size <- sqrt(length(lst))
# Stack vertically
cols <- do.call(cbind, lst)
# Split to another dim
dim(cols) <- c(dim(filter_map[[1]])[[1]],
dim(filter_map[[1]])[[1]]*sqr_size,
sqr_size)
# Stack horizontally
do.call(rbind, lapply(1:dim(cols)[3], function(i) cols[, , i]))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment