human
Can you provide a code to 1 given the following:
1.7 Exercises
==============================================================================================================
1、在第1.4.3节中编写代码，打印出训练过程当中，loss值的变化，（loss已经在训练过程中记录，找出并画成曲线即可，你也可以选择自己修改训练过程中的代码，自己实现重新画成更加漂亮的曲线。）   
2、在第1.6节，将自己的姓名的每一个字的拼音输入进去，进行预测，看模型预测是否正确（保留上面的预测结果）。如名字为张三，则输入predict('Zhang')和predict('San').   
3、编辑该cell，在下面一行回答问题。当前的BaseRNN中使用的激活函数修改成relu（在第1.3小节中），然后重新训练模型，看性能是否有变化。
当前的激活函数是（Tanh），训练集准确率为：（0.7675999999046326）验证集的准确率为：（0.39480000734329224）
激活函数为Relu时的训练准确率为：（0.770799994468689）验证集的准确率为：（0.4124000072479248）
4、编辑该cell，在下面一行记录当前的模型的准确率，然后，回到1.3中，编辑DeeperRNN类，使其比BaseRNN类更深一层，并且重新训练这个更深的网络，看新能是否有提高（记得去掉DeeperRNN那一个cell中的最后两行的注释）。对于RNN的隐藏层的增加可阅读下一个cell的补充理解
BaseRNN的训练集准确率为：（0.770799994468689）验证集的准确率为：（0.4124000072479248）
DeeperRNN的训练准确率为：（0.8001999855041504）验证集的准确率为：（0.4189999997615814）    
补充材料：    

RNNs are neural networks and everything works monotonically better (if done right) if you put on your deep learning hat and start stacking models up like pancakes. For instance, we can form a 2-layer recurrent network as follows:
python
y1 = rnn1.step(x)
y = rnn2.step(y1)
In other words we have two separate RNNs: One RNN is receiving the input vectors and the second RNN is receiving the output of the first RNN as its input. Except neither of these RNNs know or care - it’s all just vectors coming in and going out, and some gradients flowing through each module during backpropagation.

原文阅读点击这里
多层hidden网络结构图如下图所示，其中虚线输出的output表示改output值被丢弃，没有进一步使用：
<img src="./images/multihidden.png" width = "40%" />
2. Generating Names with a Character-Level RNN

We are still hand-crafting a small RNN with a few linear layers. The big
difference is instead of predicting a category after reading in all the
letters of a name, we input a category and output one letter at a time.
Recurrently predicting characters to form language (this could also be
done with words or other higher order constructs) is often referred to
as a "language model".
2.1 Creating the Network
This network extends the last tutorial's..."
Please write code following the instructions in jupyter notebook style.
assistant
#Here is code to 1.

import torch
import torch.nn as nn

class GenerateRNN(nn.Module):
    def __init__(self, input_size, hidden_size, output_size):
        super(GenerateRNN, self).__init__()
        self.hidden_size = hidden_size
        self.c2h = nn.Linear(n_categories, hidden_size)
        self.i2h = nn.Linear(input_size,   hidden_size)
        self.h2h = nn.Linear(hidden_size,  hidden_size)
        self.activation = nn.Tanh()
        self.h2o = nn.Linear(hidden_size,  output_size)
        self.dropout = nn.Dropout(0.2)

        self.softmax = nn.LogSoftmax(dim=1)

    def forward(self, category, input, hidden):
        c2h = self.c2h(category)
        i2h = self.i2h(input)
        h2h = self.h2h(hidden)
        
        hidden = self.activation( c2h+i2h+h2h )
        

        dropout = self.dropout(self.h2o(hidden))
        output = self.softmax(dropout)
        return output, hidden

    def initHidden(self, is_cuda=True):
        if is_cuda:
            return torch.zeros(1, self.hidden_size).cuda()
        else:
            return torch.zeros(1, self.hidden_size)