Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- idb2pat
- error
- pytest
- Ransomware
- mock.patch
- data distribution
- MySQL
- ecma
- javascript
- idapython
- commandline
- 포인터 매핑
- x64
- Analysis
- ida
- open office xml
- debugging
- error fix
- h5py.File
- idapro
- malware
- Injection
- ida pro
- NumPy Unicode Error
- hex-rays
- TensorFlow
- Python
- Rat
- svn update
- why error
Archives
- Today
- Total
13 Security Lab
[ERR] TypeError: Expected int32, got list containing Tensors of type '_Message' instead. 본문
Computer Science/Programming
[ERR] TypeError: Expected int32, got list containing Tensors of type '_Message' instead.
Maj0r Tom 2018. 6. 25. 22:32Tensorflow Error
Error Message:
TypeError: Expected int32, got list containing Tensors of type '_Message' instead.
Error Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | def average_gradients(tower_grads): """Calculate the average gradient for each shared variable across all towers. Note that this function provides a synchronization point across all towers. Args: tower_grads: List of lists of (gradient, variable) tuples. The outer list is over individual gradients. The inner list is over the gradient calculation for each tower. Returns: List of pairs of (gradient, variable) where the gradient has been averaged across all towers. """ average_grads = [] for grad_and_vars in zip(*tower_grads): # Note that each grad_and_vars looks like the following: # ((grad0_gpu0, var0_gpu0), ... , (grad0_gpuN, var0_gpuN)) grads = [] for g, _ in grad_and_vars: # Add 0 dimension to the gradients to represent the tower. expanded_g = tf.expand_dims(g, 0) # Append on a 'tower' dimension which we will average over below. grads.append(expanded_g) # Average over the 'tower' dimension. grad = tf.concat(0, grads) grad = tf.reduce_mean(grad, 0) # Keep in mind that the Variables are redundant because they are shared # across towers. So .. we will just return the first tower's pointer to # the Variable. v = grad_and_vars[0][1] grad_and_var = (grad, v) average_grads.append(grad_and_var) return average_grads -------------------- call function with graph.as_default(): # Average the gradients grads_e = average_gradients(tower_grads_e) grads_g = average_gradients(tower_grads_g) grads_d = average_gradients(tower_grads_d) # apply the gradients with our optimizers train_E = opt_E.apply_gradients(grads_e, global_step=global_step) train_G = opt_G.apply_gradients(grads_g, global_step=global_step) train_D = opt_D.apply_gradients(grads_d, global_step=global_step) ------------------------------- |
Problem:
The order of tf.concat's arguments changed with 1.0.
Solution:
grad = tf.concat(0, grads)
to
grad = tf.concat(grads, 0)
Reference:
https://github.com/tensorflow/tensorflow/issues/7031
Comments