52LOG_SOFTMAXtf.nn.log_softmax 53L2_NORMALIZATIONtf.math.l2_normalize 54LESStf.math.less 55LESS_EQUALtf.math.less_equal 56GREATERtf.math.greater 57GREATER_EQUALtf.math.greater_equal 58NEGtf.math.negative 59WHEREtf.where 60SELECTtf.where ...
所以说,这有了 PyTorch 里面的torch.nn.CrossEntropyLoss(输入是我们前面讲的 logits,也就是 全连接直接出来的东西)。这个 CrossEntropyLoss 其实就是等于torch.nn.LogSoftmax+torch.nn.NLLLoss。
from torch.utils.data import DataLoader import torch.nn.functional as F import torch.optim as optim #小训练集大小 batch_size = 64 #数据集的处理 #图片变换:转换成Tensor,标准化 transform = transforms.Compose([transforms.ToTensor(), transforms.Normalize((0.1307,),(0.3081,))]) #创建训练数据集 tr...
System information Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes see below OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Mac OS X 10.11.6 TensorFlow installed from (source ...