Traditional lineside signals and signs do give enough information to drive a train by a computer, but the rail industry has already chosen decades ago to integrate signalling and automation with the infrastructure, which is a completely different approach than today's self-driving cars. As a result, heavy rail and metro trains will not be "self-driving" in the same way as self-driving cars.
Now, if you say trams that run on streets, then possibly. Trams are often driven by sight and has stronger braking so it is possible to apply the same principles from self-driving cars. In fact, Siemens has been developing and testing one such tram. [1] Though I think the problem space is very similar to self-driving cars. There is no steering, but it still has to handle pedestrians and other road traffic.
[1]: https://www.mobility.siemens.com/global/en/portfolio/rail/ro...