08 2024 档案
摘要:pytorch 常见错误 RuntimeError: a leaf Variable that requires grad is being used in an in-place operation. 如下程序会抱上述错误 x=torch.randn(3,requires_grad=True) x
阅读全文
摘要:import torch import os import numpy as np import random def synthetic_data(w, b, num_examples): ''' 产生data ''' features = torch.normal(0,1,(num_exampl
阅读全文
摘要:pytorch张量运算 使用cpu gpu训练数据 torch.cuda.is_available() # 判断机器支不支持cpu 一般用如下命令: device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") fm
阅读全文
摘要:17-时间戳顺序并发控制 并发控制介绍了两种思路: 二阶段锁 悲观方法:在问题出现之前, 采取措施阻止问题的发生 缺点 锁会影响性能,锁意味着等待, Time stamp Ordering(T/0) 时间戳顺序并发控制 :根据时间戳确定顺序,决定出问题如何处理 如果事务发生时间
阅读全文