Python model.dueling_model() Examples

The following are 6 code examples of model.dueling_model(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module model , or try the search function .
Example #1
Source File: enjoy-adv.py    From neural-fingerprinting with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def __init__(self, env, dueling, noisy, fname):
        self.g = tf.Graph()
        self.noisy = noisy
        self.dueling = dueling
        self.env = env
        with self.g.as_default():
            self.act = deepq.build_act_enjoy(
                make_obs_ph=lambda name: U.Uint8Input(
                    env.observation_space.shape, name=name),
                q_func=dueling_model if dueling else model,
                num_actions=env.action_space.n,
                noisy=noisy
            )
            self.saver = tf.train.Saver()
        self.sess = tf.Session(graph=self.g)

        if fname is not None:
            print('Loading Model...')
            self.saver.restore(self.sess, fname) 
Example #2
Source File: enjoy-adv.py    From rl-attack with MIT License 6 votes vote down vote up
def __init__(self, env, dueling, noisy, fname):
		self.g = tf.Graph()
		self.noisy = noisy
		self.dueling = dueling 
		self.env = env
		with self.g.as_default():
			self.act = deepq.build_act_enjoy(
				make_obs_ph=lambda name: U.Uint8Input(env.observation_space.shape, name=name),
				q_func=dueling_model if dueling else model,
				num_actions=env.action_space.n,
				noisy=noisy
				)
			self.saver = tf.train.Saver()
		self.sess = tf.Session(graph=self.g)	
		
		if fname is not None:
			print ('Loading Model...')
			self.saver.restore(self.sess, fname) 
Example #3
Source File: enjoy-adv.py    From cleverhans with MIT License 6 votes vote down vote up
def __init__(self, env, dueling, noisy, fname):
    self.g = tf.Graph()
    self.noisy = noisy
    self.dueling = dueling
    self.env = env
    with self.g.as_default():
      self.act = deepq.build_act_enjoy(
          make_obs_ph=lambda name: U.Uint8Input(
              env.observation_space.shape, name=name),
          q_func=dueling_model if dueling else model,
          num_actions=env.action_space.n,
          noisy=noisy
      )
      self.saver = tf.train.Saver()
    self.sess = tf.Session(graph=self.g)

    if fname is not None:
      print('Loading Model...')
      self.saver.restore(self.sess, fname) 
Example #4
Source File: enjoy-adv.py    From neural-fingerprinting with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def craft_adv(self):
        with self.sess.as_default():
            with self.g.as_default():
                craft_adv_obs = deepq.build_adv(
                    make_obs_tf=lambda name: U.Uint8Input(
                        self.env.observation_space.shape, name=name),
                    q_func=dueling_model if self.dueling else model,
                    num_actions=self.env.action_space.n,
                    epsilon=1.0 / 255.0,
                    noisy=self.noisy,
                )
        return craft_adv_obs 
Example #5
Source File: enjoy-adv.py    From rl-attack with MIT License 5 votes vote down vote up
def craft_adv(self):
		with self.sess.as_default():
			with self.g.as_default():
				craft_adv_obs = deepq.build_adv(
								make_obs_tf=lambda name: U.Uint8Input(self.env.observation_space.shape, name=name),
								q_func=dueling_model if self.dueling else model,
								num_actions=self.env.action_space.n,
								epsilon = 1.0/255.0,
								noisy=self.noisy,
								)
		return craft_adv_obs 
Example #6
Source File: enjoy-adv.py    From cleverhans with MIT License 5 votes vote down vote up
def craft_adv(self):
    with self.sess.as_default():
      with self.g.as_default():
        craft_adv_obs = deepq.build_adv(
            make_obs_tf=lambda name: U.Uint8Input(
                self.env.observation_space.shape, name=name),
            q_func=dueling_model if self.dueling else model,
            num_actions=self.env.action_space.n,
            epsilon=1.0 / 255.0,
            noisy=self.noisy,
        )
    return craft_adv_obs