An apparatus, comprising: a processor that is configured to: receive training data comprising: a plurality of training image blocks; and for each training image block of the plurality of training image blocks: a plurality of partition decisions used by an encoder for encoding the training image block, wherein the plurality of partition decisions comprises a combination of splitting and non-splitting decisions that divide the training image block into a non-overlapping set of sub-blocks; and for each partition decision of the plurality of partition decisions, a rate-distortion value resulting from encoding the training image block using the partition decision; and train a neural network using a loss function to output a partition decision for encoding an image block, wherein the training comprises: inputting the training image blocks of the training data into the neural network to obtain a respective predicted partition decision for each one of the training image blocks; and inputting the respective predicted partition decisions into a rate-distortion cost estimator, which is coupled to the neural network, to obtain a respective predicted rate-distortion value for each one of the respective predicted partition decisions; wherein the loss function is a weighted combination of: a partition loss function that penalizes a deviation of the partition decisions from respective predicted partitions; and a rate-distortion cost loss function that penalizes a deviation of the rate-distortion values from respective predicted rate-distortion values. receive training data comprising: a plurality of training image blocks; and for each training image block of the plurality of training image blocks: a plurality of partition decisions used by an encoder for encoding the training image block, wherein the plurality of partition decisions comprises a combination of splitting and non-splitting decisions that divide the training image block into a non-overlapping set of sub-blocks; and for each partition decision of the plurality of partition decisions, a rate-distortion value resulting from encoding the training image block using the partition decision; and a plurality of training image blocks; and for each training image block of the plurality of training image blocks: a plurality of partition decisions used by an encoder for encoding the training image block, wherein the plurality of partition decisions comprises a combination of splitting and non-splitting decisions that divide the training image block into a non-overlapping set of sub-blocks; and for each partition decision of the plurality of partition decisions, a rate-distortion value resulting from encoding the training image block using the partition decision; and a plurality of partition decisions used by an encoder for encoding the training image block, wherein the plurality of partition decisions comprises a combination of splitting and non-splitting decisions that divide the training image block into a non-overlapping set of sub-blocks; and for each partition decision of the plurality of partition decisions, a rate-distortion value resulting from encoding the training image block using the partition decision; and train a neural network using a loss function to output a partition decision for encoding an image block, wherein the training comprises: inputting the training image blocks of the training data into the neural network to obtain a respective predicted partition decision for each one of the training image blocks; and inputting the respective predicted partition decisions into a rate-distortion cost estimator, which is coupled to the neural network, to obtain a respective predicted rate-distortion value for each one of the respective predicted partition decisions; wherein the loss function is a weighted combination of: a partition loss function that penalizes a deviation of the partition decisions from respective predicted partitions; and a rate-distortion cost loss function that penalizes a deviation of the rate-distortion values from respective predicted rate-distortion values. inputting the training image blocks of the training data into the neural network to obtain a respective predicted partition decision for each one of the training image blocks; and inputting the respective predicted partition decisions into a rate-distortion cost estimator, which is coupled to the neural network, to obtain a respective predicted rate-distortion value for each one of the respective predicted partition decisions; wherein the loss function is a weighted combination of: a partition loss function that penalizes a deviation of the partition decisions from respective predicted partitions; and a rate-distortion cost loss function that penalizes a deviation of the rate-distortion values from respective predicted rate-distortion values. a partition loss function that penalizes a deviation of the partition decisions from respective predicted partitions; and a rate-distortion cost loss function that penalizes a deviation of the rate-distortion values from respective predicted rate-distortion values.