- 博客(5)
- 收藏
- 关注
原创 【无标题】
apply(fn)方法: apply(fn) 将一个函数fn递归地应用到模块自身以及该模块的每一个子模块(即在函 数.children()中返回的子模块).该方法通常用来初始化一个模型中的参数(另见 torch-nn-init部分的内容).apply(fn)方法: apply(fn) Applies fn recursively to every submodule (as returned by .children()) as well as self...
2022-03-21 19:32:13
126
原创 callable()
callable() 函数用于检查一个对象是否是可调用的。如果返回True,object仍然可能调用失败;但如果返回False,调用对象ojbect绝对不会成功。python – 定义函数 def 后面的 ->,:表示的含义def add(x:int, y:int) ->bool: if(x>y): return True else: retur False这里,表明了函数的参数传入为int类型,输出的类型为bool类型。...
2022-03-21 19:30:00
715
原创 torch.manual_seed(seed)
torch.manual_seed(seed) – 官方文档说明:设置 (CPU) 生成随机数的种子,并返回一个torch.Generator对象。设置种子的用意是一旦固定种子,后面依次生成的随机数其实都是固定的。通过代码说明一下:import torchrandom_seed = 123torch.manual_seed(random_seed)print(torch.rand(1)) # 随机生成[0, 1)的数print(torch.rand(1))"""Out:ten
2022-03-21 19:22:35
741
1
原创 pred_classes = torch.max(pred, dim=1)[1]
>>> import torch>>> i=torch.Tensor([[1, 1, 0, 1], [0, 1, 1, 1], [0, 1, 0, 1]])>>> i.size()torch.Size([3, 4])>>> c=torch.max(i,dim=1)>>> ctorch.return_types.max(values=.
2022-03-21 11:58:43
1100
1
原创 latex中文编号是问号的问题
\documentclass{article}\usepackage{geometry}\geometry{a4paper}%\usepackage[UTF8, heading = false, scheme = plain]{ctex}%格式\usepackage{ctex}%\usepackage{authblk} %添加机构 安装preprint后可用\usepackage{graphicx} %添加图片\usepackage{amsthm}\usepackage{..
2022-01-09 18:12:46
1279
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅