Here is a simple piece of code to learn covariance of 2D gaussian.
import torch import torch.nn as nn import torch.nn.functional as F from torch.optim import