It would be easier to answer if I knew the brand / model of your opener and its age: brand new installation or existing garage door opener where its behavior suddenly changed.
For existing installations where it was operating properly and its normal functions suddenly changed (assuming that you didn’t do anything) the only thing that comes to my mind is the controller, a circuit board inside the opener enclosure.
If this is a brand new installation the problem might be in a completely different area, exactly where would depend on the manufacturer. Some of the garage door openers installations, if improperly performed would cause the garage doors to travel in an opposite direction. The part of installation that might be responsible for this action is (depending on the manufacturer) is:
a) lifting chain – might be installed in reverse
b) opener’s lifting belt might be reversed
c) opener’s trolley (the part that slides along the track) might be reversed
The sensors will always produce the same response, the only thing they do is activate the switch / relay. However, if one of the 3 conditions above is present, the door reaction will be opposite to expected.
If you have a manual, go carefully over each of the installation stages and make sure that every item has been properly installed. Until you fix the problem, disconnect the opener and operate the garage door manually.
Please let me know if this helped or if you found another solution.