试图恢复张量流中完全连接的权重

时间:2018-10-24 05:52:30

标签: python tensorflow

我正在尝试恢复张量流模型中完全连接的层的权重。我已经恢复了卷积图层的权重,效果很好。 但是,该程序不断给我以下错误。

“ FailedPreconditionError(请参阅上面的回溯):尝试使用未初始化的值fully_connected_3 / biases      [[节点:fully_connected_3 / biases / read = IdentityT = DT_FLOAT,_device =“ / job:localhost /副本:0 / task:0 / device:CPU:0”]]“

我已经通过以下方式恢复了模型。

saver = tf.train.import_meta_graph("my-model.meta")
#saver.restore(sess,tf.train.latest_checkpoint('./'))
saver.restore(sess, "my-model")
graph=tf.get_default_graph()    

W1=graph.get_tensor_by_name("W1:0")
W2=graph.get_tensor_by_name("W2:0")
#X, Y = create_placeholders(240,480, 1, 2)
X = graph.get_tensor_by_name("Placeholder:0")
Y = graph.get_tensor_by_name("Placeholder_1:0")
y_h1 = forward_propagation(X, W1, W2)

我的正向传播模型如下:

def forward_propagation(X, W1, W2):
    co1 = tf.nn.conv2d(X,W1, strides = [1,1,1,1], padding = 'SAME')
    A1 = tf.nn.relu(co1)
    po1 = tf.nn.max_pool(A1, ksize = [1,8,8,1], strides = [1,8,8,1], padding = 'SAME')
    co2 = tf.nn.conv2d(po1,W2, strides = [1,1,1,1], padding = 'SAME')
    A2 = tf.nn.relu(co2)
    po2 = tf.nn.max_pool(A2, ksize = [1,4,4,1], strides = [1,4,4,1], padding = 'SAME')
    P2_f = tf.contrib.layers.flatten(po2)
    fi = tf.contrib.layers.fully_connected(P2_f, 2, activation_fn=None)
    return fi

我尝试键入保存的模型中所有的变量。它给了我以下变量。

['Placeholder',
 'Placeholder_1',
 'W1/Initializer/random_uniform/shape',
 'W1/Initializer/random_uniform/min',
 'W1/Initializer/random_uniform/max',
 'W1/Initializer/random_uniform/RandomUniform',
 'W1/Initializer/random_uniform/sub',
 'W1/Initializer/random_uniform/mul',
 'W1/Initializer/random_uniform',
 'W1',
 'W1/Assign',
 'W1/read',
 'W2/Initializer/random_uniform/shape',
 'W2/Initializer/random_uniform/min',
 'W2/Initializer/random_uniform/max',
 'W2/Initializer/random_uniform/RandomUniform',
 'W2/Initializer/random_uniform/sub',
 'W2/Initializer/random_uniform/mul',
 'W2/Initializer/random_uniform',
 'W2',
 'W2/Assign',
 'W2/read',
 'Conv2D',
 'Relu',
 'MaxPool',
 'Conv2D_1',
 'Relu_1',
 'MaxPool_1',
 'Flatten/flatten/Shape',
 'Flatten/flatten/strided_slice/stack',
 'Flatten/flatten/strided_slice/stack_1',
 'Flatten/flatten/strided_slice/stack_2',
 'Flatten/flatten/strided_slice',
 'Flatten/flatten/Reshape/shape/1',
 'Flatten/flatten/Reshape/shape',
 'Flatten/flatten/Reshape',
 'fully_connected/weights/Initializer/random_uniform/shape',
 'fully_connected/weights/Initializer/random_uniform/min',
 'fully_connected/weights/Initializer/random_uniform/max',
 'fully_connected/weights/Initializer/random_uniform/RandomUniform',
 'fully_connected/weights/Initializer/random_uniform/sub',
 'fully_connected/weights/Initializer/random_uniform/mul',
 'fully_connected/weights/Initializer/random_uniform',
 'fully_connected/weights',
 'fully_connected/weights/Assign',
 'fully_connected/weights/read',
 'fully_connected/biases/Initializer/zeros',
 'fully_connected/biases',
 'fully_connected/biases/Assign',
 'fully_connected/biases/read',
 'fully_connected/MatMul',
 'fully_connected/BiasAdd',
 'softmax_cross_entropy_with_logits_sg/labels_stop_gradient',
 'softmax_cross_entropy_with_logits_sg/Rank',
 'softmax_cross_entropy_with_logits_sg/Shape',
 'softmax_cross_entropy_with_logits_sg/Rank_1',
 'softmax_cross_entropy_with_logits_sg/Shape_1',
 'softmax_cross_entropy_with_logits_sg/Sub/y',
 'softmax_cross_entropy_with_logits_sg/Sub',
 'softmax_cross_entropy_with_logits_sg/Slice/begin',
 'softmax_cross_entropy_with_logits_sg/Slice/size',
 'softmax_cross_entropy_with_logits_sg/Slice',
 'softmax_cross_entropy_with_logits_sg/concat/values_0',
 'softmax_cross_entropy_with_logits_sg/concat/axis',
 'softmax_cross_entropy_with_logits_sg/concat',
 'softmax_cross_entropy_with_logits_sg/Reshape',
 'softmax_cross_entropy_with_logits_sg/Rank_2',
 'softmax_cross_entropy_with_logits_sg/Shape_2',
 'softmax_cross_entropy_with_logits_sg/Sub_1/y',
 'softmax_cross_entropy_with_logits_sg/Sub_1',
 'softmax_cross_entropy_with_logits_sg/Slice_1/begin',
 'softmax_cross_entropy_with_logits_sg/Slice_1/size',
 'softmax_cross_entropy_with_logits_sg/Slice_1',
 'softmax_cross_entropy_with_logits_sg/concat_1/values_0',
 'softmax_cross_entropy_with_logits_sg/concat_1/axis',
 'softmax_cross_entropy_with_logits_sg/concat_1',
 'softmax_cross_entropy_with_logits_sg/Reshape_1',
 'softmax_cross_entropy_with_logits_sg',
 'softmax_cross_entropy_with_logits_sg/Sub_2/y',
 'softmax_cross_entropy_with_logits_sg/Sub_2',
 'softmax_cross_entropy_with_logits_sg/Slice_2/begin',
 'softmax_cross_entropy_with_logits_sg/Slice_2/size',
 'softmax_cross_entropy_with_logits_sg/Slice_2',
 'softmax_cross_entropy_with_logits_sg/Reshape_2',
 'Const',
 'Mean',
 'gradients/Shape',
 'gradients/grad_ys_0',
 'gradients/Fill',
 'gradients/Mean_grad/Reshape/shape',
 'gradients/Mean_grad/Reshape',
 'gradients/Mean_grad/Shape',
 'gradients/Mean_grad/Tile',
 'gradients/Mean_grad/Shape_1',
 'gradients/Mean_grad/Shape_2',
 'gradients/Mean_grad/Const',
 'gradients/Mean_grad/Prod',
 'gradients/Mean_grad/Const_1',
 'gradients/Mean_grad/Prod_1',
 'gradients/Mean_grad/Maximum/y',
 'gradients/Mean_grad/Maximum',
 'gradients/Mean_grad/floordiv',
 'gradients/Mean_grad/Cast',
 'gradients/Mean_grad/truediv',
 'gradients/softmax_cross_entropy_with_logits_sg/Reshape_2_grad/Shape',
 'gradients/softmax_cross_entropy_with_logits_sg/Reshape_2_grad/Reshape',
 'gradients/zeros_like',
 'gradients/softmax_cross_entropy_with_logits_sg_grad/ExpandDims/dim',
 'gradients/softmax_cross_entropy_with_logits_sg_grad/ExpandDims',
 'gradients/softmax_cross_entropy_with_logits_sg_grad/mul',
 'gradients/softmax_cross_entropy_with_logits_sg_grad/LogSoftmax',
 'gradients/softmax_cross_entropy_with_logits_sg_grad/Neg',
 'gradients/softmax_cross_entropy_with_logits_sg_grad/ExpandDims_1/dim',
 'gradients/softmax_cross_entropy_with_logits_sg_grad/ExpandDims_1',
 'gradients/softmax_cross_entropy_with_logits_sg_grad/mul_1',
 'gradients/softmax_cross_entropy_with_logits_sg_grad/tuple/group_deps',
 'gradients/softmax_cross_entropy_with_logits_sg_grad/tuple/control_dependency',
 'gradients/softmax_cross_entropy_with_logits_sg_grad/tuple/control_dependency_1',
 'gradients/softmax_cross_entropy_with_logits_sg/Reshape_grad/Shape',
 'gradients/softmax_cross_entropy_with_logits_sg/Reshape_grad/Reshape',
 'gradients/fully_connected/BiasAdd_grad/BiasAddGrad',
 'gradients/fully_connected/BiasAdd_grad/tuple/group_deps',
 'gradients/fully_connected/BiasAdd_grad/tuple/control_dependency',
 'gradients/fully_connected/BiasAdd_grad/tuple/control_dependency_1',
 'gradients/fully_connected/MatMul_grad/MatMul',
 'gradients/fully_connected/MatMul_grad/MatMul_1',
 'gradients/fully_connected/MatMul_grad/tuple/group_deps',
 'gradients/fully_connected/MatMul_grad/tuple/control_dependency',
 'gradients/fully_connected/MatMul_grad/tuple/control_dependency_1',
 'gradients/Flatten/flatten/Reshape_grad/Shape',
 'gradients/Flatten/flatten/Reshape_grad/Reshape',
 'gradients/MaxPool_1_grad/MaxPoolGrad',
 'gradients/Relu_1_grad/ReluGrad',
 'gradients/Conv2D_1_grad/ShapeN',
 'gradients/Conv2D_1_grad/Conv2DBackpropInput',
 'gradients/Conv2D_1_grad/Conv2DBackpropFilter',
 'gradients/Conv2D_1_grad/tuple/group_deps',
 'gradients/Conv2D_1_grad/tuple/control_dependency',
 'gradients/Conv2D_1_grad/tuple/control_dependency_1',
 'gradients/MaxPool_grad/MaxPoolGrad',
 'gradients/Relu_grad/ReluGrad',
 'gradients/Conv2D_grad/ShapeN',
 'gradients/Conv2D_grad/Conv2DBackpropInput',
 'gradients/Conv2D_grad/Conv2DBackpropFilter',
 'gradients/Conv2D_grad/tuple/group_deps',
 'gradients/Conv2D_grad/tuple/control_dependency',
 'gradients/Conv2D_grad/tuple/control_dependency_1',
 'beta1_power/initial_value',
 'beta1_power',
 'beta1_power/Assign',
 'beta1_power/read',
 'beta2_power/initial_value',
 'beta2_power',
 'beta2_power/Assign',
 'beta2_power/read',
 'W1/Adam/Initializer/zeros',
 'W1/Adam',
 'W1/Adam/Assign',
 'W1/Adam/read',
 'W1/Adam_1/Initializer/zeros',
 'W1/Adam_1',
 'W1/Adam_1/Assign',
 'W1/Adam_1/read',
 'W2/Adam/Initializer/zeros',
 'W2/Adam',
 'W2/Adam/Assign',
 'W2/Adam/read',
 'W2/Adam_1/Initializer/zeros',
 'W2/Adam_1',
 'W2/Adam_1/Assign',
 'W2/Adam_1/read',
 'fully_connected/weights/Adam/Initializer/zeros/shape_as_tensor',
 'fully_connected/weights/Adam/Initializer/zeros/Const',
 'fully_connected/weights/Adam/Initializer/zeros',
 'fully_connected/weights/Adam',
 'fully_connected/weights/Adam/Assign',
 'fully_connected/weights/Adam/read',
 'fully_connected/weights/Adam_1/Initializer/zeros/shape_as_tensor',
 'fully_connected/weights/Adam_1/Initializer/zeros/Const',
 'fully_connected/weights/Adam_1/Initializer/zeros',
 'fully_connected/weights/Adam_1',
 'fully_connected/weights/Adam_1/Assign',
 'fully_connected/weights/Adam_1/read',
 'fully_connected/biases/Adam/Initializer/zeros',
 'fully_connected/biases/Adam',
 'fully_connected/biases/Adam/Assign',
 'fully_connected/biases/Adam/read',
 'fully_connected/biases/Adam_1/Initializer/zeros',
 'fully_connected/biases/Adam_1',
 'fully_connected/biases/Adam_1/Assign',
 'fully_connected/biases/Adam_1/read',
 'Adam/learning_rate',
 'Adam/beta1',
 'Adam/beta2',
 'Adam/epsilon',
 'Adam/update_W1/ApplyAdam',
 'Adam/update_W2/ApplyAdam',
 'Adam/update_fully_connected/weights/ApplyAdam',
 'Adam/update_fully_connected/biases/ApplyAdam',
 'Adam/mul',
 'Adam/Assign',
 'Adam/mul_1',
 'Adam/Assign_1',
 'Adam',
 'init',
 'save/Const',
 'save/SaveV2/tensor_names',
 'save/SaveV2/shape_and_slices',
 'save/SaveV2',
 'save/control_dependency',
 'save/RestoreV2/tensor_names',
 'save/RestoreV2/shape_and_slices',
 'save/RestoreV2',
 'save/Assign',
 'save/Assign_1',
 'save/Assign_2',
 'save/Assign_3',
 'save/Assign_4',
 'save/Assign_5',
 'save/Assign_6',
 'save/Assign_7',
 'save/Assign_8',
 'save/Assign_9',
 'save/Assign_10',
 'save/Assign_11',
 'save/Assign_12',
 'save/Assign_13',
 'save/restore_all',
 'ArgMax/dimension',
 'ArgMax',
 'ArgMax_1/dimension',
 'ArgMax_1',
 'Equal',
 'Cast',
 'Const_1',
 'Mean_1',
 'Placeholder_2',
 'Placeholder_1_1',
 'W1/Initializer/random_uniform/shape_1',
 'W1/Initializer/random_uniform/min_1',
 'W1/Initializer/random_uniform/max_1',
 'W1/Initializer/random_uniform/RandomUniform_1',
 'W1/Initializer/random_uniform/sub_1',
 'W1/Initializer/random_uniform/mul_1',
 'W1/Initializer/random_uniform_1',
 'W1_1',
 'W1/Assign_1',
 'W1/read_1',
 'W2/Initializer/random_uniform/shape_1',
 'W2/Initializer/random_uniform/min_1',
 'W2/Initializer/random_uniform/max_1',
 'W2/Initializer/random_uniform/RandomUniform_1',
 'W2/Initializer/random_uniform/sub_1',
 'W2/Initializer/random_uniform/mul_1',
 'W2/Initializer/random_uniform_1',
 'W2_1',
 'W2/Assign_1',
 'W2/read_1',
 'Conv2D_2',
 'Relu_2',
 'MaxPool_2',
 'Conv2D_1_1',
 'Relu_1_1',
 'MaxPool_1_1',
 'Flatten/flatten/Shape_1',
 'Flatten/flatten/strided_slice/stack_3',
 'Flatten/flatten/strided_slice/stack_1_1',
 'Flatten/flatten/strided_slice/stack_2_1',
 'Flatten/flatten/strided_slice_1',
 'Flatten/flatten/Reshape/shape/1_1',
 'Flatten/flatten/Reshape/shape_1',
 'Flatten/flatten/Reshape_1',
 'fully_connected/weights/Initializer/random_uniform/shape_1',
 'fully_connected/weights/Initializer/random_uniform/min_1',
 'fully_connected/weights/Initializer/random_uniform/max_1',
 'fully_connected/weights/Initializer/random_uniform/RandomUniform_1',
 'fully_connected/weights/Initializer/random_uniform/sub_1',
 'fully_connected/weights/Initializer/random_uniform/mul_1',
 'fully_connected/weights/Initializer/random_uniform_1',
 'fully_connected/weights_1',
 'fully_connected/weights/Assign_1',
 'fully_connected/weights/read_1',
 'fully_connected/biases/Initializer/zeros_1',
 'fully_connected/biases_1',
 'fully_connected/biases/Assign_1',
 'fully_connected/biases/read_1',
 'fully_connected/MatMul_1',
 'fully_connected/BiasAdd_1',
 'softmax_cross_entropy_with_logits_sg/labels_stop_gradient_1',
 'softmax_cross_entropy_with_logits_sg/Rank_3',
 'softmax_cross_entropy_with_logits_sg/Shape_3',
 'softmax_cross_entropy_with_logits_sg/Rank_1_1',
 'softmax_cross_entropy_with_logits_sg/Shape_1_1',
 'softmax_cross_entropy_with_logits_sg/Sub/y_1',
 'softmax_cross_entropy_with_logits_sg/Sub_3',
 'softmax_cross_entropy_with_logits_sg/Slice/begin_1',
 'softmax_cross_entropy_with_logits_sg/Slice/size_1',
 'softmax_cross_entropy_with_logits_sg/Slice_3',
 'softmax_cross_entropy_with_logits_sg/concat/values_0_1',
 'softmax_cross_entropy_with_logits_sg/concat/axis_1',
 'softmax_cross_entropy_with_logits_sg/concat_2',
 'softmax_cross_entropy_with_logits_sg/Reshape_3',
 'softmax_cross_entropy_with_logits_sg/Rank_2_1',
 'softmax_cross_entropy_with_logits_sg/Shape_2_1',
 'softmax_cross_entropy_with_logits_sg/Sub_1/y_1',
 'softmax_cross_entropy_with_logits_sg/Sub_1_1',
 'softmax_cross_entropy_with_logits_sg/Slice_1/begin_1',
 'softmax_cross_entropy_with_logits_sg/Slice_1/size_1',
 'softmax_cross_entropy_with_logits_sg/Slice_1_1',
 'softmax_cross_entropy_with_logits_sg/concat_1/values_0_1',
 'softmax_cross_entropy_with_logits_sg/concat_1/axis_1',
 'softmax_cross_entropy_with_logits_sg/concat_1_1',
 'softmax_cross_entropy_with_logits_sg/Reshape_1_1',
 'softmax_cross_entropy_with_logits_sg_1',
 'softmax_cross_entropy_with_logits_sg/Sub_2/y_1',
 'softmax_cross_entropy_with_logits_sg/Sub_2_1',
 'softmax_cross_entropy_with_logits_sg/Slice_2/begin_1',
 'softmax_cross_entropy_with_logits_sg/Slice_2/size_1',
 'softmax_cross_entropy_with_logits_sg/Slice_2_1',
 'softmax_cross_entropy_with_logits_sg/Reshape_2_1',
 'Const_2',
 'Mean_2',
 'gradients/Shape_1',
 'gradients/grad_ys_0_1',
 'gradients/Fill_1',
 'gradients/Mean_grad/Reshape/shape_1',
 'gradients/Mean_grad/Reshape_1',
 'gradients/Mean_grad/Shape_3',
 'gradients/Mean_grad/Tile_1',
 'gradients/Mean_grad/Shape_1_1',
 'gradients/Mean_grad/Shape_2_1',
 'gradients/Mean_grad/Const_2',
 'gradients/Mean_grad/Prod_2',
 'gradients/Mean_grad/Const_1_1',
 'gradients/Mean_grad/Prod_1_1',
 'gradients/Mean_grad/Maximum/y_1',
 'gradients/Mean_grad/Maximum_1',
 'gradients/Mean_grad/floordiv_1',
 'gradients/Mean_grad/Cast_1',
 'gradients/Mean_grad/truediv_1',
 'gradients/softmax_cross_entropy_with_logits_sg/Reshape_2_grad/Shape_1',
 'gradients/softmax_cross_entropy_with_logits_sg/Reshape_2_grad/Reshape_1',
 'gradients/zeros_like_1',
 'gradients/softmax_cross_entropy_with_logits_sg_grad/ExpandDims/dim_1',
 'gradients/softmax_cross_entropy_with_logits_sg_grad/ExpandDims_2',
 'gradients/softmax_cross_entropy_with_logits_sg_grad/mul_2',
 'gradients/softmax_cross_entropy_with_logits_sg_grad/LogSoftmax_1',
 'gradients/softmax_cross_entropy_with_logits_sg_grad/Neg_1',
 'gradients/softmax_cross_entropy_with_logits_sg_grad/ExpandDims_1/dim_1',
 'gradients/softmax_cross_entropy_with_logits_sg_grad/ExpandDims_1_1',
 'gradients/softmax_cross_entropy_with_logits_sg_grad/mul_1_1',
 'gradients/softmax_cross_entropy_with_logits_sg_grad/tuple/group_deps_1',
 'gradients/softmax_cross_entropy_with_logits_sg_grad/tuple/control_dependency_2',
 'gradients/softmax_cross_entropy_with_logits_sg_grad/tuple/control_dependency_1_1',
 'gradients/softmax_cross_entropy_with_logits_sg/Reshape_grad/Shape_1',
 'gradients/softmax_cross_entropy_with_logits_sg/Reshape_grad/Reshape_1',
 'gradients/fully_connected/BiasAdd_grad/BiasAddGrad_1',
 'gradients/fully_connected/BiasAdd_grad/tuple/group_deps_1',
 'gradients/fully_connected/BiasAdd_grad/tuple/control_dependency_2',
 'gradients/fully_connected/BiasAdd_grad/tuple/control_dependency_1_1',
 'gradients/fully_connected/MatMul_grad/MatMul_2',
 'gradients/fully_connected/MatMul_grad/MatMul_1_1',
 'gradients/fully_connected/MatMul_grad/tuple/group_deps_1',
 'gradients/fully_connected/MatMul_grad/tuple/control_dependency_2',
 'gradients/fully_connected/MatMul_grad/tuple/control_dependency_1_1',
 'gradients/Flatten/flatten/Reshape_grad/Shape_1',
 'gradients/Flatten/flatten/Reshape_grad/Reshape_1',
 'gradients/MaxPool_1_grad/MaxPoolGrad_1',
 'gradients/Relu_1_grad/ReluGrad_1',
 'gradients/Conv2D_1_grad/ShapeN_1',
 'gradients/Conv2D_1_grad/Conv2DBackpropInput_1',
 'gradients/Conv2D_1_grad/Conv2DBackpropFilter_1',
 'gradients/Conv2D_1_grad/tuple/group_deps_1',
 'gradients/Conv2D_1_grad/tuple/control_dependency_2',
 'gradients/Conv2D_1_grad/tuple/control_dependency_1_1',
 'gradients/MaxPool_grad/MaxPoolGrad_1',
 'gradients/Relu_grad/ReluGrad_1',
 'gradients/Conv2D_grad/ShapeN_1',
 'gradients/Conv2D_grad/Conv2DBackpropInput_1',
 'gradients/Conv2D_grad/Conv2DBackpropFilter_1',
 'gradients/Conv2D_grad/tuple/group_deps_1',
 'gradients/Conv2D_grad/tuple/control_dependency_2',
 'gradients/Conv2D_grad/tuple/control_dependency_1_1',
 'beta1_power/initial_value_1',
 'beta1_power_1',
 'beta1_power/Assign_1',
 'beta1_power/read_1',
 'beta2_power/initial_value_1',
 'beta2_power_1',
 'beta2_power/Assign_1',
 'beta2_power/read_1',
 'W1/Adam/Initializer/zeros_1',
 'W1/Adam_2',
 'W1/Adam/Assign_1',
 'W1/Adam/read_1',
 'W1/Adam_1/Initializer/zeros_1',
 'W1/Adam_1_1',
 'W1/Adam_1/Assign_1',
 'W1/Adam_1/read_1',
 'W2/Adam/Initializer/zeros_1',
 'W2/Adam_2',
 'W2/Adam/Assign_1',
 'W2/Adam/read_1',
 'W2/Adam_1/Initializer/zeros_1',
 'W2/Adam_1_1',
 'W2/Adam_1/Assign_1',
 'W2/Adam_1/read_1',
 'fully_connected/weights/Adam/Initializer/zeros/shape_as_tensor_1',
 'fully_connected/weights/Adam/Initializer/zeros/Const_1',
 'fully_connected/weights/Adam/Initializer/zeros_1',
 'fully_connected/weights/Adam_2',
 'fully_connected/weights/Adam/Assign_1',
 'fully_connected/weights/Adam/read_1',
 'fully_connected/weights/Adam_1/Initializer/zeros/shape_as_tensor_1',
 'fully_connected/weights/Adam_1/Initializer/zeros/Const_1',
 'fully_connected/weights/Adam_1/Initializer/zeros_1',
 'fully_connected/weights/Adam_1_1',
 'fully_connected/weights/Adam_1/Assign_1',
 'fully_connected/weights/Adam_1/read_1',
 'fully_connected/biases/Adam/Initializer/zeros_1',
 'fully_connected/biases/Adam_2',
 'fully_connected/biases/Adam/Assign_1',
 'fully_connected/biases/Adam/read_1',
 'fully_connected/biases/Adam_1/Initializer/zeros_1',
 'fully_connected/biases/Adam_1_1',
 'fully_connected/biases/Adam_1/Assign_1',
 'fully_connected/biases/Adam_1/read_1',
 'Adam/learning_rate_1',
 'Adam/beta1_1',
 'Adam/beta2_1',
 'Adam/epsilon_1',
 'Adam/update_W1/ApplyAdam_1',
 'Adam/update_W2/ApplyAdam_1',
 'Adam/update_fully_connected/weights/ApplyAdam_1',
 'Adam/update_fully_connected/biases/ApplyAdam_1',
 'Adam/mul_2',
 'Adam/Assign_2',
 'Adam/mul_1_1',
 'Adam/Assign_1_1',
 'Adam_1',
 'init_1',
 'save/Const_1',
 'save/SaveV2/tensor_names_1',
 'save/SaveV2/shape_and_slices_1',
 'save/SaveV2_1',
 'save/control_dependency_1',
 'save/RestoreV2/tensor_names_1',
 'save/RestoreV2/shape_and_slices_1',
 'save/RestoreV2_1',
 'save/Assign_14',
 'save/Assign_1_1',
 'save/Assign_2_1',
 'save/Assign_3_1',
 'save/Assign_4_1',
 'save/Assign_5_1',
 'save/Assign_6_1',
 'save/Assign_7_1',
 'save/Assign_8_1',
 'save/Assign_9_1',
 'save/Assign_10_1',
 'save/Assign_11_1',
 'save/Assign_12_1',
 'save/Assign_13_1',
 'save/restore_all_1',
 'ArgMax/dimension_1',
 'ArgMax_2',
 'ArgMax_1/dimension_1',
 'ArgMax_1_1',
 'Equal_1',
 'Cast_1',
 'Const_1_1',
 'Mean_1_1',
 'Placeholder_3',
 'Placeholder_1_2',
 'W1/Initializer/random_uniform/shape_2',
 'W1/Initializer/random_uniform/min_2',
 'W1/Initializer/random_uniform/max_2',
 'W1/Initializer/random_uniform/RandomUniform_2',
 'W1/Initializer/random_uniform/sub_2',
 'W1/Initializer/random_uniform/mul_2',
 'W1/Initializer/random_uniform_2',
 'W1_2',
 'W1/Assign_2',
 'W1/read_2',
 'W2/Initializer/random_uniform/shape_2',
 'W2/Initializer/random_uniform/min_2',
 'W2/Initializer/random_uniform/max_2',
 'W2/Initializer/random_uniform/RandomUniform_2',
 'W2/Initializer/random_uniform/sub_2',
 'W2/Initializer/random_uniform/mul_2',
 'W2/Initializer/random_uniform_2',
 'W2_2',
 'W2/Assign_2',
 'W2/read_2',
 'Conv2D_3',
 'Relu_3',
 'MaxPool_3',
 'Conv2D_1_2',
 'Relu_1_2',
 'MaxPool_1_2',
 'Flatten/flatten/Shape_2',
 'Flatten/flatten/strided_slice/stack_4',
 'Flatten/flatten/strided_slice/stack_1_2',
 'Flatten/flatten/strided_slice/stack_2_2',
 'Flatten/flatten/strided_slice_2',
 'Flatten/flatten/Reshape/shape/1_2',
 'Flatten/flatten/Reshape/shape_2',
 'Flatten/flatten/Reshape_2',
 'fully_connected/weights/Initializer/random_uniform/shape_2',
 'fully_connected/weights/Initializer/random_uniform/min_2',
 'fully_connected/weights/Initializer/random_uniform/max_2',
 'fully_connected/weights/Initializer/random_uniform/RandomUniform_2',
 'fully_connected/weights/Initializer/random_uniform/sub_2',
 'fully_connected/weights/Initializer/random_uniform/mul_2',
 'fully_connected/weights/Initializer/random_uniform_2',
 'fully_connected/weights_2',
 'fully_connected/weights/Assign_2',
 'fully_connected/weights/read_2',
 'fully_connected/biases/Initializer/zeros_2',
 'fully_connected/biases_2',
 'fully_connected/biases/Assign_2',
 'fully_connected/biases/read_2',
 'fully_connected/MatMul_2',
 'fully_connected/BiasAdd_2',
 'softmax_cross_entropy_with_logits_sg/labels_stop_gradient_2',
 'softmax_cross_entropy_with_logits_sg/Rank_4',
 'softmax_cross_entropy_with_logits_sg/Shape_4',
 'softmax_cross_entropy_with_logits_sg/Rank_1_2',
 'softmax_cross_entropy_with_logits_sg/Shape_1_2',
 'softmax_cross_entropy_with_logits_sg/Sub/y_2',
 'softmax_cross_entropy_with_logits_sg/Sub_4',
 'softmax_cross_entropy_with_logits_sg/Slice/begin_2',
 'softmax_cross_entropy_with_logits_sg/Slice/size_2',
 'softmax_cross_entropy_with_logits_sg/Slice_4',
 'softmax_cross_entropy_with_logits_sg/concat/values_0_2',
 'softmax_cross_entropy_with_logits_sg/concat/axis_2',
 'softmax_cross_entropy_with_logits_sg/concat_3',
 'softmax_cross_entropy_with_logits_sg/Reshape_4',
 'softmax_cross_entropy_with_logits_sg/Rank_2_2',
 'softmax_cross_entropy_with_logits_sg/Shape_2_2',
 'softmax_cross_entropy_with_logits_sg/Sub_1/y_2',
 'softmax_cross_entropy_with_logits_sg/Sub_1_2',
 'softmax_cross_entropy_with_logits_sg/Slice_1/begin_2',
 'softmax_cross_entropy_with_logits_sg/Slice_1/size_2',
 'softmax_cross_entropy_with_logits_sg/Slice_1_2',
 'softmax_cross_entropy_with_logits_sg/concat_1/values_0_2',
 'softmax_cross_entropy_with_logits_sg/concat_1/axis_2',
 'softmax_cross_entropy_with_logits_sg/concat_1_2',
 'softmax_cross_entropy_with_logits_sg/Reshape_1_2',
 'softmax_cross_entropy_with_logits_sg_2',
 'softmax_cross_entropy_with_logits_sg/Sub_2/y_2',
 'softmax_cross_entropy_with_logits_sg/Sub_2_2',
 'softmax_cross_entropy_with_logits_sg/Slice_2/begin_2',
 'softmax_cross_entropy_with_logits_sg/Slice_2/size_2',
 'softmax_cross_entropy_with_logits_sg/Slice_2_2',
 'softmax_cross_entropy_with_logits_sg/Reshape_2_2',
 'gradients/Conv2D_1_grad/Conv2DBackpropInput_2',
 'gradients/Conv2D_1_grad/Conv2DBackpropFilter_2',
 'gradients/Conv2D_1_grad/tuple/group_deps_2',
 'gradients/Conv2D_1_grad/tuple/control_dependency_3',
 'gradients/Conv2D_1_grad/tuple/control_dependency_1_2',
 'gradients/MaxPool_grad/MaxPoolGrad_2',
 'gradients/Relu_grad/ReluGrad_2',
 'gradients/Conv2D_grad/ShapeN_2',
 'gradients/Conv2D_grad/Conv2DBackpropInput_2',
 'gradients/Conv2D_grad/Conv2DBackpropFilter_2',
 'gradients/Conv2D_grad/tuple/group_deps_2',
 'gradients/Conv2D_grad/tuple/control_dependency_3',
 'gradients/Conv2D_grad/tuple/control_dependency_1_2',
 'beta1_power/initial_value_2',
 'beta1_power_2',
 'beta1_power/Assign_2',
 'beta1_power/read_2',
 'beta2_power/initial_value_2',
 'beta2_power_2',
 'beta2_power/Assign_2',
 'beta2_power/read_2',
 'W1/Adam/Initializer/zeros_2',
 'W1/Adam_3',
 'W1/Adam/Assign_2',
 'W1/Adam/read_2',
 'W1/Adam_1/Initializer/zeros_2',
 'W1/Adam_1_2',
 'W1/Adam_1/Assign_2',
 'W1/Adam_1/read_2',
 'W2/Adam/Initializer/zeros_2',
 'W2/Adam_3',
 'W2/Adam/Assign_2',
 'W2/Adam/read_2',
 'W2/Adam_1/Initializer/zeros_2',
 'W2/Adam_1_2',
 'W2/Adam_1/Assign_2',
 'W2/Adam_1/read_2',
 'fully_connected/weights/Adam/Initializer/zeros/shape_as_tensor_2',
 'fully_connected/weights/Adam/Initializer/zeros/Const_2',
 'fully_connected/weights/Adam/Initializer/zeros_2',
 'fully_connected/weights/Adam_3',
 'fully_connected/weights/Adam/Assign_2',
 'fully_connected/weights/Adam/read_2',
 'fully_connected/weights/Adam_1/Initializer/zeros/shape_as_tensor_2',
 'fully_connected/weights/Adam_1/Initializer/zeros/Const_2',
 'fully_connected/weights/Adam_1/Initializer/zeros_2',
 'fully_connected/weights/Adam_1_2',
 'fully_connected/weights/Adam_1/Assign_2',
 'fully_connected/weights/Adam_1/read_2',
 'fully_connected/biases/Adam/Initializer/zeros_2',
 'fully_connected/biases/Adam_3',
 'fully_connected/biases/Adam/Assign_2',
 'fully_connected/biases/Adam/read_2',
 'fully_connected/biases/Adam_1/Initializer/zeros_2',
 'fully_connected/biases/Adam_1_2',
 'fully_connected/biases/Adam_1/Assign_2',
 'fully_connected/biases/Adam_1/read_2',
 'Adam/learning_rate_2',
 'Adam/beta1_2',
 'Adam/beta2_2',
 'Adam/epsilon_2',
 'Adam/update_W1/ApplyAdam_2',
 'Adam/update_W2/ApplyAdam_2',
 'Adam/update_fully_connected/weights/ApplyAdam_2',
 'Adam/update_fully_connected/biases/ApplyAdam_2',
 'Adam/mul_3',
 'Adam/Assign_3',
 'Adam/mul_1_2',
 'Adam/Assign_1_2',
 'Adam_2',
 'init_2']

我不确定如何从完全连接的网络恢复权重。 我也尝试了以下方法,但没有用。

activation_b1 = graph.get_tensor_by_name('fully_connected_1/biases:0')
activation_w2 = graph.get_tensor_by_name('fully_connected_1/weights:0')

请让我知道如何从已保存的模型中提取完全关联的权重。

0 个答案:

没有答案