def log_layer_activations(self, tag, x, layer_names, step=None):
    step = (step or self.global_step)
    import copy
    model = copy.copy(self.model)
    activations = utils.register_activations(model, layer_names)
    model.eval()
    _ = self.model(x)
    for layer_name in activations:
        features = activations[layer_name].detach().cpu()
        if (features.shape[0] > 8):
            features = features[:8]
        for c in range(features.shape[1]):
            features_c = features[:, [c], :, :, :].permute(0, 2, 1, 3, 4)
            features_c = utils.array_to_float_video(features_c, 0.1, 99.9)
            self.logger.experiment.add_video('{}/{}/ch{}'.format(tag, layer_name, c), features_c, step)
def log_layer_activations(self, tag, x, layer_names, step=None):
    step = (step or self.global_step)
    import copy
    model = copy.copy(self.model)
    activations = utils.register_activations(model, layer_names)
    model.eval()
    _ = self.model(x)
    for layer_name in activations:
        features = activations[layer_name].detach().cpu()
        if (features.shape[0] > 8):
            features = features[:8]
        for c in range(features.shape[1]):
            features_c = features[:, [c], :, :, :].permute(0, 2, 1, 3, 4)
            features_c = utils.array_to_float_video(features_c, 0.1, 99.9)
            self.logger.experiment.add_video('{}/{}/ch{}'.format(tag, layer_name, c), features_c, step)