Open grasskin opened 1 year ago
Hi @grasskin -
I am successfully able to run swim_transformer.py example in keras 3.5.0 and it is working fine by creating custom layer like this:
self.relative_position_index = keras.Variable(initializer=relative_position_index,shape=relative_position_index.shape,
dtype="int",trainable=False,)
Attached gist for the reference.
Ran into this with swim_transformer.py example. We create a custom layer that uses numpy ops and a tensorflow variable to store state.
Despite being initialized inside the
build()
method, we do not seem to be creating a tensorflow namespace by default and so the variable cannot be created. Workaround is to passinitial_value
as a lambda function:Full error log: