在使用jupyter notebook学习动手学深度学习时,出现以下错误:
%matplotlib inline
import math
import torch
from torch import nn
from torch.nn import functional as F
from d2l import torch as d2lbatch_size, num_steps 32, 35
train_iter, voca…
基本语法
从键盘输入
使用 Scanner 读取字符串/整数/浮点数 在idea中这个包是自动导入的!
使用 Scanner 循环读取 N 个数字,并求取其平均值
Scanner sc new Scanner(System.in);
int sum 0;
int num 0;
while (sc.hasNextInt()) {int tmp sc.nex…