Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot directly use Prebuilt Models in other models #12

Open
zhengqing-cn opened this issue Jul 4, 2021 · 0 comments
Open

Cannot directly use Prebuilt Models in other models #12

zhengqing-cn opened this issue Jul 4, 2021 · 0 comments

Comments

@zhengqing-cn
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant