自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(12)
  • 收藏
  • 关注

原创 PyTorch学习笔记(五):自动微分机制

1. 利用backward方法求导数loss.backward(),无返回值梯度信息在需要求导的变量的属性中:w1.grad、w2.grad# f(x) = a*x^2 + b*x + c的导数x = torch.tensor(0.0, requires_grad=True) # x需要被求导a = torch.tensor(1.0)b = torch.tensor(-2.0)c = torch.tensor(1.0)y = a*torch.pow(x,2) + b*x + c y.

2021-12-02 08:31:30 1178

原创 torch.where()

torch.where(condition, x, y) → TensorReturn a tensor of elements selected from either x or y, depending on condition.condition = torch.tensor([[0.6, 0.7], [0.8, 0.4]])print(condition)x = torch.zeros(2,2)print(x)y = torch.ones(2,2)print(y)# 输出ten.

2021-11-30 09:33:24 675

原创 PyTorch学习笔记(四):Tensor合并与分割

cata = torch.rand(4,32,8)b = torch.rand(5,32,8)print(torch.cat([a, b], dim=0).shape) # torch.Size([9, 32, 8])stack: create new dima = torch.rand(32,8)b = torch.rand(32,8)print(torch.stack([a, b], dim=0).shape) # torch.Size([2, 32, 8])split:

2021-11-30 09:20:58 1399

原创 PyTorch学习笔记(三):Tensor变换

view/reshapea = torch.rand(4,1,28,28)print(a.shape) # torch.Size([4, 1, 28, 28])print(a.view(4, 28*28).shape) # torch.Size([4, 784])print(a.reshape(4, 28*28).shape) # torch.Size([4, 784])print(a.view(4, -1).shape) #

2021-11-30 09:02:09 490

原创 PyTorch学习笔记(二):索引与切片

Indexing: dim 0 firsta = torch.rand(4,3,28,28)print(a.dim()) print(a.shape)# 输出4torch.Size([4, 3, 28, 28])print(a[0].shape) # torch.Size([3, 28, 28])print(a[0, 0].shape) # torch.Size([28, 28])print(a[0, 0, 0].shape) # torch.S

2021-11-29 21:49:42 271

原创 PyTorch学习笔记(一):创建Tensor

1、Tensor的维度和尺寸不同类型的数据可以用不同维度(dimension)的张量来表示,标量为0维张量,向量为1维张量,矩阵为2维以上的张量;可以简单地总结为:有几层中括号,就是多少维的张量;可以使用shape属性或者size()方法查看张量在每一维的长度;标量:# 标量(0维张量)scalar = torch.tensor(1)print(scalar)print(scalar.dim()) print(scalar.size())print(scalar.shape)# 输出te

2021-11-29 21:28:43 220

原创 nn.Parameter()

class Model(nn.Module): def __init__(self): super(Model, self).__init__() self.embedding = nn.Embedding(5, 10) self.dense_1 = nn.Linear(10, 5, bias=True) self.dense_2 = nn.Linear(5, 1, bias=True) def

2021-11-29 20:46:30 1361

原创 conda管理Jupyter Notebook中的kernel

查看jupyter kernelspec list删除jupyter kernelspec remove ‘kernelname’添加conda虚拟环境激活conda环境:source activate 环境名称安装ipykernel:conda install ipykernel将环境写入notebook的kernel中:python -m ipykernel install --user --name 环境名称 --display-name “你想为kernel添加的名称..

2021-11-29 20:02:55 343

原创 conda常用命令

创建环境激活环境退出环境删除环境其他常用命令

2021-11-29 19:50:57 167

原创 tf.gather和tf.gather_nd

tf.gatherGather slices from params axis according to indices.tf.gather(params, indices, validate_indices=None, axis=None, batch_dims=0, name=None)Example:# data: [classes, students, subjects]data = tf.ones([4,35,8])print(data.shape) # TensorShap

2021-11-23 09:10:10 853

原创 torch.gather()

torch.gather(input, dim, index) → TensorGathers values along an axis specified by dim.For a 3-D tensor the output is specified by:out[i][j][k] = input[index[i][j][k]][j][k] # if dim == 0out[i][j][k] = input[i][index[i][j][k]][k] # if dim.

2021-11-23 08:46:30 1048

原创 知识追踪(一):BKT

知识追踪(Knowledge Tracing)是根据学生过去的答题情况对学生的知识掌握情况进行建模,从而得到学生当前知识状态表示的一种技术。Bayesian Knowledge Tracing (BKT) 1是最早期的一种知识追踪模型,是含有隐变量的Hidden Markov Model(HMM)。BKT对每个知识点单独建立一个HMM模型,来预测学生在特定知识点的掌握情况(模型不考虑知识点之间的相关性)。

2021-11-02 20:36:23 5979

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除