1. A neural network system implemented as one or more computers for generating samples of a particular sample type, wherein each generated sample belongs to a respective category of a predetermined set of categories, and wherein each generated sample is an ordered collection of values, each value having a sample position in the collection, and wherein the system comprises: a first stochastic layer configured to stochastically select a category from the predetermined set of categories; a first deterministic subnetwork configured to: receive an embedding vector corresponding to the selected category, and process the embedding vector to generate a respective sample score for each sample position in the collection; and a second stochastic layer configured to generate an output sample by stochastically selecting, for each sample position, a sample value using the sample score for the sample position.