Python 图中作为numpy数组的张量的计算?
有什么方法可以对图中的张量进行计算吗 我的图表示例:Python 图中作为numpy数组的张量的计算?,python,numpy,tensorflow,deep-learning,Python,Numpy,Tensorflow,Deep Learning,有什么方法可以对图中的张量进行计算吗 我的图表示例: slim = tf.contrib.slim def slim_graph(images, train=False): with slim.arg_scope([slim.conv2d, slim.fully_connected], activation_fn=tf.nn.relu, weights_initializer=tf.truncated_normal
slim = tf.contrib.slim
def slim_graph(images, train=False):
with slim.arg_scope([slim.conv2d, slim.fully_connected],
activation_fn=tf.nn.relu,
weights_initializer=tf.truncated_normal_initializer(0.0, 0.01),
weights_regularizer=slim.l2_regularizer(0.0005)):
net = slim.repeat(images, 2, slim.conv2d, 64, [3, 3], scope='conv1')
// Do my compute by numpy on net
np_array_result = my_func(net)
// It will return a numpy array
// Use numpy array as input of graph
net = slim.max_pool2d(np_array_result, [2, 2], scope='pool1')
...
return logits
- 我们能做那样的事吗
- 如何在图形中获取特征映射以进行计算
但这似乎很奇怪。您可以将包装器用于python函数。是的,像您所展示的那样分为两部分是一种方法it@YaroslavBulatov当前位置当我做前向网时,它似乎没问题。训练步骤时,我们如何运行损失函数和梯度?在得到第2部分的结果并在其上应用梯度后,只需计算损失?