This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# most of the code is taken form Practical RL week0 assignment (https://github.com/yandexdataschool/Practical_RL/tree/master/week0) | |
# I'm just trying out OpenAI submission interface | |
import numpy as np | |
import os | |
import gym | |
from gym import wrappers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GuidedBackprop(torch.nn.Module): | |
def __init__(self, model, n_classes): | |
super().__init__() | |
self.model = model | |
self.n_classes = n_classes | |
self.gradients = None | |
self.model.eval() | |
self.update_relus() | |
self.hook_first_layer() |