Implement the Prototypical Networks algorithm. Prototypical Networks is a meta-learning algorithm that aims to learn a model that can quickly adapt to new tasks with few examples. The algorithm consists of two stages: the inner loop and the outer loop. In the inner loop, the model is updated to fit the current task using gradient descent. In the outer loop, the model is updated to fit the meta-task using gradient descent.
**Example:** Suppose we have two tasks: task A and task B. Task A has 5 examples, and task B has 3 examples. We want to train a model that can quickly adapt to these tasks.
**Constraints:** The model should be able to adapt to new tasks with few examples. The algorithm should be able to learn a model that can generalize to new tasks.
**Note:** This is a simplified version of the Prototypical Networks algorithm. In practice, you may need to add more components, such as a meta-optimizer and a meta-loss function.
Test Cases
[{'x': [1, 2], 'y': [3, 4]}, {'x': [5, 6], 'y': [7, 8]}][1.0, 2.0][{'x': [9, 10], 'y': [11, 12]}, {'x': [13, 14], 'y': [15, 16]}][9.0, 10.0]