Skip to content

Cannot directly use Prebuilt Models in other models #12

Open
@zhengqing-cn

Description

@zhengqing-cn

Hi,

I want to use the prebuilt conv ODE blocks in a the network. However, there always shows below error:

Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm 2021.1.1\plugins\python\helpers\pydev_pydevd_bundle\pydevd_exec2.py", line 3, in Exec
exec(exp, global_vars, local_vars)
File "", line 1, in
File "C:\Users\ZhengQing\anaconda3\envs\tensorflow-gpu_115\lib\site-packages\tensorflow_core\python\keras\engine\base_layer.py", line 869, in call
outputs = self._symbolic_call(inputs)
File "C:\Users\ZhengQing\anaconda3\envs\tensorflow-gpu_115\lib\site-packages\tensorflow_core\python\keras\engine\base_layer.py", line 2158, in _symbolic_call
output_shapes = self.compute_output_shape(input_shapes)
File "C:\Users\ZhengQing\anaconda3\envs\tensorflow-gpu_115\lib\site-packages\tensorflow_core\python\keras\engine\network.py", line 699, in compute_output_shape
return super(Network, self).compute_output_shape(input_shape)
File "C:\Users\ZhengQing\anaconda3\envs\tensorflow-gpu_115\lib\site-packages\tensorflow_core\python\keras\engine\base_layer.py", line 646, in compute_output_shape
raise NotImplementedError
NotImplementedError

And Here is my code:

from tensorflow.keras.models import Model
from tensorflow.keras.layers import Conv2D, Dense, Flatten, Input, MaxPooling2D, Layer, Lambda, Conv2DTranspose, BatchNormalization, AveragePooling2D, UpSampling2D, concatenate

from tfdiffeq.models import Conv2dODENet

def test_model(input_layer):
x = Conv2D(8, (3, 3), activation="relu", kernel_initializer='he_normal', padding="same")(input_layer)
x = Conv2D(8, (3, 3), activation="relu", kernel_initializer='he_normal', padding="same")(x)
output_layer = Conv2dODENet(num_filters = 2, augment_dim=0, time_dependent=False)(x)

model = Model(inputs=input_layer, outputs=output_layer)

model.compile(...)

return model

input_layer = Input(shape=(160, 208, 4))
model = test_model(input_layer)

Could you kindly help me to check whether my implementation is correct? Many thanks in advance!

Best,
ZQ

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions