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

More advanced rescaling by inputs #16

Open
jlperla opened this issue Nov 3, 2021 · 0 comments
Open

More advanced rescaling by inputs #16

jlperla opened this issue Nov 3, 2021 · 0 comments

Comments

@jlperla
Copy link
Member

jlperla commented Nov 3, 2021

If we find that we want more control over what inputs are rescaled, then something like

class RescaleInputsbyInput(nn.Module):
    def __init__(self, rescale_index, inputs_to_rescale = None):
        super().__init__()
        self.rescale_index = rescale_index

        # if inputs_to_rescale is None, then it assume all except the current one.
        if inputs_to_rescale is None:
            self.inputs_to_rescale = # generate all indices except the rescale_index one.
       else:
           self.inputs_to_rescale = inputs_to_rescale
        
    def forward(self, x):
        rescale_scalar = 1 / x[self.rescale_index]        
        new_x = # multiple all indices in "inputs_to_rescale" by "rescale_scalar".
        return new_x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants