回答編集履歴
1
d
test
CHANGED
@@ -66,19 +66,37 @@
|
|
66
66
|
|
67
67
|
```python
|
68
68
|
|
69
|
+
import numpy as np
|
70
|
+
|
71
|
+
import tensorflow as tf
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
N, M = 5, 3
|
76
|
+
|
77
|
+
x = np.random.rand(10, N, M)
|
78
|
+
|
79
|
+
y = np.random.rand(10, N)
|
80
|
+
|
81
|
+
|
82
|
+
|
69
83
|
x_in = tf.placeholder(tf.float32, shape=[None, N, M])
|
70
84
|
|
71
85
|
y_in = tf.placeholder(tf.float32, shape=[None, N])
|
72
86
|
|
73
87
|
|
74
88
|
|
75
|
-
z_
|
89
|
+
z_out = x_in * tf.expand_dims(y_in, axis=-1)
|
76
90
|
|
77
91
|
|
78
92
|
|
79
93
|
with tf.Session() as sess:
|
80
94
|
|
81
|
-
|
95
|
+
ret = sess.run(z_out, feed_dict={x_in: x, y_in: y})
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
print(ret)
|
82
100
|
|
83
101
|
```
|
84
102
|
|