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

Problem with GeometricSandwichProductDense Usage #1

Open
WY-2022 opened this issue Feb 27, 2025 · 0 comments
Open

Problem with GeometricSandwichProductDense Usage #1

WY-2022 opened this issue Feb 27, 2025 · 0 comments

Comments

@WY-2022
Copy link

WY-2022 commented Feb 27, 2025

Hi,

Thank you for publishing the code. I encountered an issue when trying to run it.

#modifying the last layer
idx = ga.get_kind_blade_indices("even")
model = InceptionV3(classifier_activation = None, weights = "imagenet", input_tensor=Input(shape=(224, 224, 3)))

x2 = Dropout(0.3)(model.layers[-2].output)
x2 = Reshape((-1, 8))(x2)
x2 = TensorToGeometric(ga, blade_indices=idx)(x2)
x2 = GeometricSandwichProductDense(
        ga, units=128, activation = "relu",
        blade_indices_kernel=idx,
        blade_indices_bias=idx)(x2)
x2 = GeometricSandwichProductDense(
        ga, units=64, activation = "relu",
        blade_indices_kernel=idx,
        blade_indices_bias=idx)(x2)
x2 = GeometricSandwichProductDense(
        ga, units=1, activation = "tanh",
        blade_indices_kernel=idx,
        blade_indices_bias=idx)(x2)
x2 = GeometricToTensor(ga, blade_indices=idx)(x2)
outputs2 = Flatten()(x2)


Model1 = tf.keras.Model(inputs=model.input, outputs=outputs2)
Model1.summary()
CGAPoseNet = Model1
TypeError Traceback (most recent call last)
Cell In[5], line 10
8 x2 = Reshape((-1, 8))(x2)
9 x2 = TensorToGeometric(ga, blade_indices=idx)(x2)
---> 10 x2 = GeometricSandwichProductDense(
11 ga, units=128, activation = "relu",
12 blade_indices_kernel=idx,
13 blade_indices_bias=idx)(x2)
14 x2 = GeometricSandwichProductDense(
15 ga, units=64, activation = "relu",
16 blade_indices_kernel=idx,
17 blade_indices_bias=idx)(x2)
18 outputs2 = GeometricSandwichProductDense(
19 ga, units=1, activation = "tanh",
20 blade_indices_kernel=idx,
21 blade_indices_bias=idx)(x2)

File ~/miniconda3/envs/tf/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py:122, in filter_traceback..error_handler(*args, **kwargs)
119 filtered_tb = _process_traceback_frames(e.traceback)
120 # To get the full stack trace, call:
121 # keras.config.disable_traceback_filtering()
--> 122 raise e.with_traceback(filtered_tb) from None
123 finally:
124 del filtered_tb

File ~/miniconda3/envs/tf/lib/python3.11/site-packages/tfga/layers.py:189, in GeometricProductDense.build(self, input_shape)
183 self.num_input_units = input_shape[-2]
184 shape_kernel = [
185 self.units,
186 self.num_input_units,
187 self.blade_indices_kernel.shape[0],
188 ]
--> 189 self.kernel = self.add_weight(
190 "kernel",
191 shape=shape_kernel,
192 initializer=self.kernel_initializer,
193 regularizer=self.kernel_regularizer,
194 constraint=self.kernel_constraint,
195 dtype=self.dtype,
196 trainable=True,
197 )
198 if self.use_bias:
199 shape_bias = [self.units, self.blade_indices_bias.shape[0]]

TypeError: Layer.add_weight() got multiple values for argument 'shape'

Is this issue caused by an incompatibility between the versions of tf and tfga?

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