33 private_key = (f, g)
34 return public_key, private_key
35
36 def encrypt(self, message, public_key): 37 """
38 Encrypt a message using the public key.
39
22 self.chain = []
23 self.create_block(proof=1, previous_hash="0")
24
25 def create_block(self, proof, previous_hash):26 block = {
27 "index": len(self.chain) + 1,
28 "timestamp": time.time(),
26 action = np.random.choice(self.action_dim, p=action_probs[0])
27 return action
28
29 def update(self, state, action, reward, next_state, done):30 state = np.array(state).reshape(1, -1)
31 next_state = np.array(next_state).reshape(1, -1)
32 action_onehot = np.zeros(self.action_dim)
6 def __init__(self, model):
7 self.model = model
8
9 def attention_visualization(self, input_data, attention_layer_name):10 attention_layer = self.model.get_layer(attention_layer_name)
11 attention_weights = attention_layer.get_weights()[0]
12 attention_weights = tf.squeeze(attention_weights, axis=0)
An unused argument can lead to confusions. It should be removed. If this variable is necessary, name the variable _
or start the name with unused
or _unused
.
def square(x, y=1):
return x * x
class MySubClass(MyClass):
def __init__(self, number):
self.value = 42 # argument `number` remains unused
def square(x):
return x * x
class MySubClass(MyClass):
def __init__(self, _):
self.value = 42