Every time I input data, I want to call the method for each input

    for data in loader:
        train = data['input'][:,:-2700]
        train = train.to(DEVICE)

        target = data['input'][:,-2700:]
        target = target.to(DEVICE)

        model.set_model(data['input_num'])

        output = model(data)

Every time I input data, I want to call the set_model method for each input.
However, Error occurs because input_num, which is a single value, changes to batch_size.
Is there a good way?

For example, I set the batch_size to 8, and I want to call each of the eight methods in one batch.

You could use a loop, if you want to call each value separately.
I don’t know, what set_model means, but if it cannot accept batched data, you would have to fallback to the loop (or use a batch size of 1).