gin-config icon indicating copy to clipboard operation
gin-config copied to clipboard

[Question] How to define a parameter based on a defined one

Open minhtriet opened this issue 1 year ago • 3 comments

In config.gin, I cannot do something like

GAT.embed_dim = 30     # this is for init of GAT

Attention.node_ft_dim = GAT.__init__.embed_dim
# Attention.node_ft_dim = GAT.embed_dim      # this won't work too

It won't work even when I

@gin.register
@gin.configurable
class GAT(nn.Module):

Is this feature implemented?

minhtriet avatar Mar 05 '23 14:03 minhtriet

@minhtriet Same here, was looking for this feature!

marcospiau avatar Apr 12 '23 04:04 marcospiau

A workaround for this might be to use a MACRO

EMBED_DIM = 30

GAT.embed_dim = %EMBED_DIM
Attention.node_ft_dim = %EMBED_DIM

alexd314 avatar May 03 '23 22:05 alexd314

is there a way to do calculations with macros like this?

EMBED_DIM = 30

GAT.embed_dim = 2*%EMBED_DIM

Bloos avatar Mar 22 '24 13:03 Bloos