Although such as Normal distribution, Bernoulli distribution and Beta distribution are already prepared by PyTorch, how can we create a self-made distribution?
In other words, I’d like to turn some functions which I made into a distribution instance and use .sample() method for example.
If that’s coding question - you derive a class from Distribution abstract class and implement some methods of its interface. Just look at source code of some distribution and write yours similarly.
If you ask about .[r]sample(), that has to be implemented manually, normally that is either some transformation of samples from other distributions, or quantile based sampling.
There is also TransformedDistribution that may be useful.