小编Phạ*_*iển的帖子

ValueError:模型的输出张量必须是TensorFlow`Telay`的输出

我正在使用最后一层中的一些tensorflow函数(reduce_sum和l2_normalize)在Keras中构建模型,同时遇到此问题.我已经搜索了一个解决方案,但所有这些都与"Keras tensor"有关.

这是我的代码:

import tensorflow as tf;
from tensorflow.python.keras import backend as K

vgg16_model = VGG16(weights = 'imagenet', include_top = False, input_shape = input_shape);

fire8 = extract_layer_from_model(vgg16_model, layer_name = 'block4_pool');

pool8 = MaxPooling2D((3,3), strides = (2,2), name = 'pool8')(fire8.output);

fc1 = Conv2D(64, (6,6), strides= (1, 1), padding = 'same', name = 'fc1')(pool8);

fc1 = Dropout(rate = 0.5)(fc1);

fc2 = Conv2D(3, (1, 1), strides = (1, 1), padding = 'same', name = 'fc2')(fc1);

fc2 = Activation('relu')(fc2);

fc2 = Conv2D(3, (15, 15), …
Run Code Online (Sandbox Code Playgroud)

python machine-learning keras tensorflow tensor

19
推荐指数
2
解决办法
1万
查看次数

误解C++中的循环?

我有一些C++循环周期的问题,这是我的代码:

    for (int ii = 1; ii <= 4; ii++)
    {
        if (ii==1)
        {
            ro = 4;
            ratio = 0.85;
        }
        if (ii == 2)
        {
            ro = 6;
            ratio = 0.8;
        }
        if (ii == 3)
        {
            ro = 8;
            ratio = 0.9;
        }
        if (ii == 4)
        {
            ro = 10;
            ratio = 0.5;
        }

       function(ro,ratio);

       if (ii = 1)
       {
          cir4 = cir.clone();
          k4 = k3.clone();
       }
       if (ii = 2)
       {
          cir6 = cir.clone();
          k6 = …
Run Code Online (Sandbox Code Playgroud)

c++

0
推荐指数
1
解决办法
74
查看次数

标签 统计

c++ ×1

keras ×1

machine-learning ×1

python ×1

tensor ×1

tensorflow ×1