ai4co / rl4co

A PyTorch library for all things Reinforcement Learning (RL) for Combinatorial Optimization (CO)
https://rl4.co
MIT License
381 stars 70 forks source link

[Minor] Am decoder refactor #179

Closed LTluttmann closed 3 months ago

LTluttmann commented 3 months ago

Description

Refactoring of the Attention model's decoder.

Motivation and Context

By outsourcing the computation of glimpse_<q,k,v> and logit_k tensors into separate functions, we allow for more flexibility when reusing this decoder for other models. In scheduling for example, we need to select the embedding of the next operation for each job. This can now be achieved by simply overwriting the _comput_kvlfunction.

Types of changes

What types of changes does your code introduce? Remove all that do not apply:

Checklist

Go over all the following points, and put an x in all the boxes that apply. If you are unsure about any of these, don't hesitate to ask. We are here to help!

LTluttmann commented 3 months ago

@fedebotu ok just realized it might also be useful to have an exchangeable Pointer haha

fedebotu commented 3 months ago

ok just realized it might also be useful to have an exchangeable Pointer haha

Yeah we had a similar issue in another project and had to copy-paste everythin :rofl: this will help