pytorch
pytorch
氵文大师
我年华虚度,空有一身疲倦
展开
-
[文档] torch.distributions.Categorical
.原创 2022-08-15 23:32:02 · 1506 阅读 · 0 评论 -
default_collate: batch must contain tensors, numpy arrays, numbers, dicts or lists; found object
Torch跑的时候报了这个:TypeErrordefault_collate: batch must contain tensors, numpy arrays, numbers, dicts or lists; found object我之前加载数据的操作应该木啥问题好吧:就是先继承 torch.utils.data.Dataset 类写一个子类然后 init 一个 torch.utils.data.DataLoader 对象结果在调用的时候:for x, y in trainloader原创 2021-09-11 21:37:07 · 9764 阅读 · 0 评论 -
关于PyTorch中的inplace操作和Hook
本来也想水一篇博客的,但是前辈已经写的很好了,花了两天时间精读了一下,感觉还是转载一下,记录一下为好Torch中的AutoGradhttps://zhuanlan.zhihu.com/p/69294347Torch中的Inplace操作https://www.cnblogs.com/jiangkejie/p/13390377.htmlTorch中的Hookhttps://www.zhihu.com/question/61044004Torch中的Hook(详细版)https://oldpa转载 2021-08-24 16:02:03 · 301 阅读 · 0 评论 -
cuda10.0环境安装Pytorch
前置环境需要安装cuda10.0和对应的cudnn不在赘述,如需查看请参考这两篇博客(面向小白的,十分详细):手把手教你win10安装Paddlepaddle-GPU(一)手把手教你win10安装Paddlepaddle-GPU(二)尴尬的是,官网好像比较支持CUDA9.2和CUDA10.1,没有CUDA10.0的一席之地…从官网中找到稳定版下载的网址https://download.pytorch.org/whl/torch_stable.html搜索cu100,可以发现,Pytorch原创 2020-08-08 13:16:17 · 3129 阅读 · 0 评论 -
线性回归中,三种梯度下降MGD、BGD与MBGD对比研究(三)——以鸢尾花数据集为例
上一次,写了MGD、SGD、MBGD的代码实现,现在,我们来康康实例我们以大名鼎鼎的鸢尾花数据集为例:https://archive.ics.uci.edu/ml/machine-learning-databases/iris/下载这个iris.data即可将其置于当前工作文件夹即可先导入需要的库:import numpy as npimport pandas as pdimp...原创 2020-03-12 15:05:42 · 973 阅读 · 4 评论 -
线性回归中,三种梯度下降MGD、BGD与MBGD对比研究(二)——Python轮子实现
在上一篇中,我们简单的说明了MGD、BGD与MBGD的原理,这一次,我们用numpy实现一下:先导入需要的库:import numpy as npimport pandas as pdimport random此处插入一小段,来说明数据结构:可以简单的说:X是没有标签的训练数据shape==(m, n)y是训练数据的标签shape==(m, )theta是线性回归的参数sh...原创 2020-03-12 14:02:18 · 589 阅读 · 0 评论 -
线性回归中,三种梯度下降MGD、BGD与MBGD对比研究(一)——公式推导
1.线性回归我们都知道,一般线性回归的假设函数为:hθ=∑j=1nθjxjh_{\theta} = \sum_{j=1}^{n}\theta_{j}x_{j}hθ=j=1∑nθjxj即:hθ(X)=θTXh_{\theta}(\mathbf{X}) = \boldsymbol{\theta}^{T}\mathbf{X}hθ(X)=θTX其中:θ=(θ1,θ2,...,θn)T...原创 2020-03-12 13:22:37 · 1127 阅读 · 0 评论 -
AttributeError: module 'tensorflow.python.estimator.api.estimator' has no attribute 'SessionRunHook'
报错原文:AttributeError: module 'tensorflow.python.estimator.api.estimator' has no attribute 'SessionRunHook'接上一篇博客,安装完 tensorboard,在第一次运行时,报了这个错,猜测是与tensorflow的环境发生冲突,SO:pip uninstall tensorflow主要卸载...原创 2020-03-12 09:18:43 · 2803 阅读 · 0 评论 -
ImportError: TensorBoard logging requires TensorBoard with Python summary writer installed. This sho
报错文案:from torch.utils.tensorboard import SummaryWriterImportError: TensorBoard logging requires TensorBoard with Python summary writer installed. This should be available in 1.14 or above.前两题急于用在...原创 2020-03-12 08:33:34 · 6125 阅读 · 0 评论