(name, shape)
| 13 | |
| 14 | |
| 15 | def create_embedding_table(name, shape): |
| 16 | if shape[0] == shape[1]: |
| 17 | # Make a one-hot encoding as the initial value. |
| 18 | initial_val = np.identity(n=shape[0], dtype=np.float32) |
| 19 | return tf.Variable(initial_val, name=name) |
| 20 | else: |
| 21 | return create_variable(name, shape) |
| 22 | |
| 23 | |
| 24 | def create_bias_variable(name, shape): |
no test coverage detected