# Input argument is an empty tuple, using register\_forward\_pre\_hook

**URL:** <https://discuss.pytorch.org/t/input-argument-is-an-empty-tuple-using-register-forward-pre-hook/157709>\
**Category:** vision\
**Created:** [July 28, 2022, 10:23am UTC](https://discuss.pytorch.org/t/input-argument-is-an-empty-tuple-using-register-forward-pre-hook/157709 "2022-07-28T10:23:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alireza\_dizaji](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/alireza_dizaji/32/38663_2.png) [@alireza\_dizaji](https://discuss.pytorch.org/u/alireza_dizaji)\
**Post date:** [July 28, 2022, 10:23am UTC](https://discuss.pytorch.org/t/input-argument-is-an-empty-tuple-using-register-forward-pre-hook/157709/1 "2022-07-28T10:23:38Z")

</div>

Hi,  
I am trying to use register\_forward\_pre\_hook to modify one of my model’s forward input, and it seems the hook cannot recognize any of the input arguments. Here is my code which is a wrapper for the models of a library using keyword arguments for its forward function and I tried to separate two of the arguments which are necessary for modification.

```auto
class GNNWrapper(nn.Module):
    """ the only point of this class is to pass `x` and `edge_index` as separate input
    arguments and therefore torch hooks could recognize them"""
    
    def __init__ (self, model: GNNBasic) -> None:
        super(). __init__ ()

        self._model: GNNBasic = model

    def forward(self, x, edge_index, *args, **kwargs):
        kwargs['x'] = x
        kwargs['edge_index'] = edge_index

        return self._model(*args, **kwargs)

```
