CyberZHG / keras-lr-multiplier

Learning rate multiplier
https://pypi.org/project/keras-lr-multiplier/
Other
46 stars 11 forks source link

support for keras 2.3.1 and tensorflow 2.0 #6

Closed betterze closed 4 years ago

betterze commented 4 years ago

Describe the Bug

It seems like this package doesn't not support tf 2.0, it was fine beore i upgraded my tf.

It is fine to compile model, but when you start training, it shows:

InvalidArgumentError: cannot compute Equal as input #1(zero-based) was expected to be a float tensor but is a int64 tensor [Op:Equal]

Version Info

keras 2.3.1

tensorflow 2.0

Minimal Codes To Reproduce

from keras.models import Sequential
from keras.layers import Dense
from keras_lr_multiplier import LRMultiplier

model = Sequential()
model.add(Dense(
    units=5,
    input_shape=(5,),
    activation='tanh',
    name='Dense',
))
model.add(Dense(
    units=2,
    activation='softmax',
    name='Output',
))
model.compile(
    optimizer=LRMultiplier('adam', {'Dense': 0.5, 'Output': 1.5}),
    loss='sparse_categorical_crossentropy',
)
#%%
import numpy as np
x=np.random.random([100,5])
y=np.random.random([100,1])

model.fit(x,y)
stale[bot] commented 4 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

betterze commented 4 years ago

The problem is still there. I think it is because the code is written in tf 1, and could not be used in tf 2.

stale[bot] commented 4 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.