swish pytorch_使用CSS3快速构建Swish Teaser页面

swish pytorch

在本教程中,您将学习如何仅使用CSS,不使用图像甚至使用Photoshop设计来构建预告页面。 许多网站和即将发布的应用程序从前导页面获得了广泛的宣传,因此这是添加到您的工具箱中的有用概念。 将其用于准备启动的任何应用程序或网站。


步骤1: HTML标记

宣传页面HTML非常简单。 我们只有一个带有介绍性文字和输入内容的容器。

<!doctype html>

<head>

	<!-- Basics -->
	
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	
	<title>App is coming soon.</title>
	
	<!-- Mobile -->
	
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

	<!-- CSS -->
	
	<link rel="stylesheet" href="css/reset.css">
	<link rel="stylesheet" href="css/animate.css">
	<link rel="stylesheet" href="css/styles.css">
	
</head>

	<!-- Main HTML -->
	
<body>
	
	<!-- Begin Page Content -->
	
	<div id="container">
	
		<h1>App.</h1>
		
		<p>
		This amazing application will change your life. Subscribe to be notified when it's available, or follow us on <a href="#">Twitter.</a>
		</p>
		
		<div id="subscribe">
		
		<input type="email" placeholder="email address">
		
		<input type="submit" value="submit">
		
		</div>
		
	</div>
	
	
	<!-- End Page Content -->
	
</body>

</html>

步骤2:定位和调整元素大小

让我们给页面一些结构。 我们从基础开始,然后将容器放置在页面的中央。 我们将使用50%的定位,然后使用负边距将对象恢复为宽度和高度的一半。

html, body {
	width: 100%;
	height: 100%;
	font-family: "Helvetica Neue", Helvetica, sans-serif;
	color: #444;
	-webkit-font-smoothing: antialiased;
}
	
	
}

#container {
	position: fixed;
	width: 500px;
	height: 300px;
	top: 50%;
	left: 50%;
	margin-top: -150px;
	margin-left: -250px;
	text-align: center;
}

接下来,我们使用属性选择器定位文本和输入,以电子邮件为目标并分别提交输入。

h1 {
	font-size: 90px;
}

p {
	width: 80%;
	font-size: 23px;
	line-height: 1.3em;
	margin: 1.1em auto;
	text-align: center;
}

#subscribe {
	margin: 0 auto;
	text-align: center;
}

input[type=email] {
	width: 90%;
	padding: 15px;
	margin: 0 auto;
}

input[type=submit] {
	position: absolute;
	margin-left: -105px;
	margin-top: 5px;
	padding: 10px;
	width: 100px;
	height: 50px;
}

步骤3:样式化文字

此页面的文字样式非常简单。 我们希望名称与背景形成对比,因此将其设为白色。 文字很重要,但是我们希望访客记住我们产品的名称,因此我们不会将其发音如此。 Twitter链接带有下划线,表示它是一个链接。

一,主要文字:

h1 {
	font-size: 90px;
	font-weight: bold;
	color: #fff;
	text-shadow: 0 1px 4px #000;
	margin-top: 20px;
}

p {
	width: 80%;
	font-size: 23px;
	line-height: 1.3em;
	color: #fff;
	margin: 1.1em auto;
	text-align: center;
	text-shadow: 0 0 2px rgba(0, 0, 0, 0.9);
}

然后是Twitter链接:

p a {
	color: #fff;
	border-bottom: 2px solid #2da1ec;
}

步骤4:设定背景样式

现在,有趣的部分是:为页面上的对象提供额外的je ne sais quoi 。 我们将从创建一个漂亮的渐变背景开始。 如果您是Mac用户,则可以依靠GradientApp为您完成艰苦的工作。 另外, 请前往CSS3! 了解一些语法。

html, body {
	width: 100%;
	height: 100%;
	font-family: "Helvetica Neue", Helvetica, sans-serif;
	color: #444;
	-webkit-font-smoothing: antialiased;
	background: #000222;
	background: -moz-linear-gradient(top,  #000222 0%, #4b637c 100%);
	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#000222), color-stop(100%,#4b637c));
	background: -webkit-linear-gradient(top,  #000222 0%,#4b637c 100%);
	background: -o-linear-gradient(top,  #000222 0%,#4b637c 100%);
	background: -ms-linear-gradient(top,  #000222 0%,#4b637c 100%);
	background: linear-gradient(top,  #000222 0%,#4b637c 100%);
	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#000222', endColorstr='#4b637c',GradientType=0 );	
}

步骤5:设置订阅表单的样式

订阅表单是我们页面的重点,因为我们希望访问者了解我们惊人的产品何时发布。 我们希望它成为页面的焦点,在名称或徽标之后。

我们首先设置占位符的样式(Mozilla和Webkit特定的样式),然后设置字体大小:

::-webkit-input-placeholder {
 	   color: rgba(255, 255, 255, 0.4);
 	}
 	
 	::-moz-input-placeholder {
 	   color: rgba(255, 255, 255, 0.4);
 	}
 	
 	input {
 		font-family: "Helvetica Neue", Helvetica, sans-serif;
 		font-size: 25px;
 	}

现在让我们为字段和按钮提供一些颜色和深度:

input[type=email] {
  		outline: none;
  		width: 90%;
  		padding: 15px;
  		margin: 0 auto;
  		color: #fff;
  		border: none;
  		-webkit-border-radius: 6px;
  		-moz-border-radius: 6px;
  		border-radius: 6px;
  		background: rgba(0, 0, 0, 0.3);
  		-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.9);
  		-moz-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.9);
  		-o-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.9);
  		box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.9);
  	}
  	
  	input[type=submit] {
  		position: absolute;
  		margin-left: -105px;
  		margin-top: 5px;
  		font-size: 25px;
  		color: #222;
  		text-shadow: 0 1px 0 #fff;
  		padding: 10px;
  		width: 100px;
  		height: 50px;
  		border: none;
  		background: #f0f0f0;
  		background: -moz-linear-gradient(top, #f0f0f0 0%, #c3d7ff 100%);
  		background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f0f0f0), color-stop(100%,#c3d7ff));
  		background: -webkit-linear-gradient(top, #f0f0f0 0%,#c3d7ff 100%);
  		background: -o-linear-gradient(top, #f0f0f0 0%,#c3d7ff 100%);
  		background: -ms-linear-gradient(top, #f0f0f0 0%,#c3d7ff 100%);
  		background: linear-gradient(top, #f0f0f0 0%,#c3d7ff 100%);
  		filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f0f0f0', endColorstr='#c3d7ff',GradientType=0 );
  		-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 1), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  		-moz-box-shadow: 0 0 5px rgba(0, 0, 0, 1), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  		-o-box-shadow: 0 0 5px rgba(0, 0, 0, 1), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  		box-shadow: 0 0 5px rgba(0, 0, 0, 1), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  		-webkit-border-radius: 3px;
  		-moz-border-radius: 3px;
  		border-radius: 3px;
  		cursor: pointer;
  	}

步骤6:添加CSS过渡

让我们添加一些不错CSS过渡来帮助吸引访问者的注意力。

首先,我们将鼠标悬停和活动状态添加到Twitter链接和输入中:

p a {
   	color: #fff;
   	border-bottom: 2px solid #2da1ec;
   }
   
   p a:hover {
   	color: #2da1ec;
   	border-bottom: 2px solid #fff;
   }
input[type=email] {
  	outline: none;
  	width: 90%;
  	padding: 15px;
  	margin: 0 auto;
  	color: #fff;
  	border: none;
  	-webkit-border-radius: 6px;
  	-moz-border-radius: 6px;
  	border-radius: 6px;
  	background: rgba(0, 0, 0, 0.3);
  	-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.9);
  	-moz-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.9);
  	-o-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.9);
  	box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.9);
  }
  
  input[type=email]:hover {
  	background: rgba(0, 0, 0, 0.5);
  }
  
  input[type=email]:focus {
  	-webkit-box-shadow: inset 0 0 8px rgba(0, 0, 0, 1), 0 0 0 5px rgba(0, 0, 0, 0.2);
  	-moz-box-shadow: inset 0 0 8px rgba(0, 0, 0, 1), 0 0 0 5px rgba(0, 0, 0, 0.2);
  	-o-box-shadow: inset 0 0 8px rgba(0, 0, 0, 1), 0 0 0 5px rgba(0, 0, 0, 0.2);
  	box-shadow: inset 0 0 8px rgba(0, 0, 0, 1), 0 0 0 5px rgba(0, 0, 0, 0.2);
  	background: rgba(0, 0, 0, 0.6);
  }
  
  input[type=submit] {
  	position: absolute;
  	margin-left: -105px;
  	margin-top: 5px;
  	font-size: 25px;
  	color: #222;
  	text-shadow: 0 1px 0 #fff;
  	padding: 10px;
  	width: 100px;
  	height: 50px;
  	border: none;
  	background: #f0f0f0;
  	background: -moz-linear-gradient(top, #f0f0f0 0%, #c3d7ff 100%);
  	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f0f0f0), color-stop(100%,#c3d7ff));
  	background: -webkit-linear-gradient(top, #f0f0f0 0%,#c3d7ff 100%);
  	background: -o-linear-gradient(top, #f0f0f0 0%,#c3d7ff 100%);
  	background: -ms-linear-gradient(top, #f0f0f0 0%,#c3d7ff 100%);
  	background: linear-gradient(top, #f0f0f0 0%,#c3d7ff 100%);
  	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f0f0f0', endColorstr='#c3d7ff',GradientType=0 );
  	-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 1), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  	-moz-box-shadow: 0 0 5px rgba(0, 0, 0, 1), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  	-o-box-shadow: 0 0 5px rgba(0, 0, 0, 1), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  	box-shadow: 0 0 5px rgba(0, 0, 0, 1), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  	-webkit-border-radius: 3px;
  	-moz-border-radius: 3px;
  	border-radius: 3px;
  	cursor: pointer;
  }
  
  input[type=submit]:hover {
  	-webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.9);
  	-moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.9);
  	-o-box-shadow: 0 0 10px rgba(0, 0, 0, 0.9);
  	box-shadow: 0 0 10px rgba(0, 0, 0, 0.9);
  	width: 125px;
  	margin-left: -130px;
  	
  }
  
  input[type=submit]:active {
  	background: #c3d7ff;
  	background: -moz-linear-gradient(top,  #c3d7ff 0%, #f0f0f0 100%);
  	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#c3d7ff), color-stop(100%,#f0f0f0));
  	background: -webkit-linear-gradient(top,  #c3d7ff 0%,#f0f0f0 100%);
  	background: -o-linear-gradient(top,  #c3d7ff 0%,#f0f0f0 100%);
  	background: -ms-linear-gradient(top,  #c3d7ff 0%,#f0f0f0 100%);
  	background: linear-gradient(top,  #c3d7ff 0%,#f0f0f0 100%);
  	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#c3d7ff', endColorstr='#f0f0f0',GradientType=0 );
  	
  }

然后我们添加过渡规则:

p a {
   	color: #fff;
   	border-bottom: 2px solid #2da1ec;
   	-webkit-transition: all .4s ease;
   	-moz-transition: all .4s ease;
   	-o-transition: all .4s ease;
   	transition: all .4s ease;
   }

和

input {
   	font-family: "Helvetica Neue", Helvetica, sans-serif;
   	font-size: 25px;
   	-webkit-transition: all .4s ease;
   	-moz-transition: all .4s ease;
   	-o-transition: all .4s ease;
   	transition: all .4s ease;
   }

步骤7: CSS动画

我们也可以在页面加载时添加一些不错CSS3动画,以增加效果。 建议使用CSS动画作为设计的补充。 不是它的组成部分。 对动画的支持仍然很少,因此 ,请注意不要过于复杂化设计。

也就是说,Dan Eden的Animate.css是一个非常有用CSS动画库。 您可以按照本教程开始时原始文档中所示的那样添加它,也可以根据需要将其导入样式表中:

@import url(animate.css);

有多种精美的动画可供选择,但我将添加bounceInDown动画。 我们将其应用于元素(在本例中为容器),如下所示:

#container {
   	position: fixed;
   	width: 500px;
   	height: 300px;
   	top: 50%;
   	left: 50%;
   	margin-top: -150px;
   	margin-left: -250px;
   	text-align: center;
   	-webkit-animation-name: bounceInDown;
   	-webkit-animation-fill-mode: both;
   	-webkit-animation-duration: 1.5s;
   	-webkit-animation-iteration-count: 1;
   	-webkit-animation-timing-function: linear;
   	-moz-animation-name: bounceInDown;
   	-moz-animation-fill-mode: both;
   	-moz-animation-duration: 1.5s;
   	-moz-animation-iteration-count: 1;
   	-moz-animation-timing-function: linear;
   	animation-name: bounceInDown;
   	animation-fill-mode: both;
   	animation-duration: 1.5s;
   	animation-iteration-count: 1;
   	animation-timing-function: linear;
   }

如果要更改动画,只需将-animation-name更改为-animation-name的动画名称。


步骤8:进一步发展

这并不是一个响应式设计,但与之相去甚远,但是您可能想在CSS底部添加几个媒体查询,以适应较小的设备。 考虑将容器元素缩小以适合较小的屏幕,并更改输入的宽度或位置。


为了允许我们的注册表单将电子邮件地址添加到列表,我们可以将其连接到电子邮件通讯服务,例如MailChimp。 我不会详细解释这一点,因为本文完美地展示了它。

如果您想向表单添加验证,则可以查看本教程。


结论

建立这样的快速预告页面对于在网站或产品发布之前进行宣传至关重要。 正如这个纯CSS解决方案所示,它不必太复杂。

希望您从本教程中学到了什么,谢谢阅读!

翻译自: https://webdesign.tutsplus.com/articles/quickly-build-a-swish-teaser-page-with-css3--webdesign-6532

swish pytorch

机器学习损失函数 / 激活函数 / 优化算法 总览 关键词:交叉熵,KL散度(相对熵),BCELoss,Contrastive loss,triplet loss,n-pair loss,focal loss sigmoid,tanh,ReLU,PReLU,ELU,GeLU BGD,SGD,momentum,NAG,AdaGrad,RMSprop,Adam,AdamW 阅读详情

相关推荐

激活函数Swish

激活函数Swish系列文章:   Swish函数先对来说是比较新的一些激活函数,算是由之前的激活函数复合而成出来的。也是由Google提出的,毕竟资力雄厚,承担的起搜索的任务。而且这个算法感觉曝光率还算比较高,就在这里整理一下,同时后面的文章也会再次提到这个函数。   对前面的激活函数有了一定的基础之后,理解Swish激活就容易很多了,Swish函数的表达式是f(x)=x⋅σ(x)f(x)=x·\sigma(x)f(x)=x⋅σ(x),σ(x)\sigma(x)σ(x)就是sigmoid函数。因为sigmo

August-us的博客 3万+

Pytorch Swish()激活函数

import torch import torch.nn as nn import torch.optim as optim class Net(nn.Module): def __init__(self): super(Net,self).__init__() self.main=nn.Sequential( nn.Linear(2,20), Swish(), nn.Linear(20,20), Swish(), nn.Linear(20,1) ) def f

Nancy_fairy的博客 6909

pytorch 激活函数

inplace=True会x把输入前的删掉了,都变成了输入后的, 没有inplace,输入还是输入,输出是新的了。 import torch import torch.nn as nn #inplace为True,将会改变输入的数据 ,否则不会改变原输入,只会产生新的输出 m = nn.LeakyReLU(inplace=True) input = torch.randn(7) p...

jacke121的专栏 3617

Swish和SwiGLU激活函数介绍

Swish是一种简单的平滑激活函数,PyTorch 内置了等效的实现 (torch.nn.SiLU或torch.nn.functional.siluSwiGLU是基于 Swish 的门控激活函数,常用于高效前馈神经网络,需要自定义实现。这两种激活函数在现代深度学习模型(特别是自然语言处理任务)中表现出色。

qq_27390023的博客 2847

神经网络中各种激活函数的Python实现

本资源主要是可视化各种激活函数:Relu,sigmoid ,swish,mish等,只需要依赖numpy,不需要安装pytorch,只是一个简单的demo

PyTorch中常用的激活函数的方法示例

主要介绍了PyTorch中常用的激活函数的方法示例,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧

PyTorch中激活函数GELU、Swish、Mish函数的实现

GELU的中文名为高斯误差线性单元,它在自然语言处理领域被广泛应用。GELU激活函数结合了激活参数1或0的取值概率和神经网络的激活值,使得神经网络的激活值越小,其所乘的激活概率为1的概率越小,以此保留概率性和对输入的依赖性。具体实现如下: def gelu(x): return 0.5*x*(1+tanh(np.sqrt(2/np.pi)*(x+0.044715*pow(x,3)))) Swish和Mish函数可以看作是GELU的一个特例,可以替换模型中现有的激活函数,使模型精度有所提高。实现

qq_39332551的博客 5859

分数计算器(C++课设)

需求概述 (1)设计一个分数计算器,进行分数的算术运算和逻辑运算。 (2)能够像使用基本数据的对象一样,对分数进行“+”、“-”、“*”和“/”等算术运算和比较两个分数的大小。 (3)以a/b的形式输入输出分数,允许输入输出整数这种特殊形式。 (4)对不是约化型的分数进行约化,避免分母为负数。 (5)如果分数的分母为0、除数为0或输入时格式有错,采用异常处理机制解决。 输入 以分数的形式输入。(如1/2) 若分母为0会抛出异常,重新输入。 菜单页面 RationalNumber.h(头文件) #ifnd

sadnessss的博客 8770

激活模型与激活函数(pytorch)

1、sigmoid函数 torch.nn.sigmoid() 公式: 是早期发展使用频率最高的函数,将输出平滑的映射到0~1,是便于求导的平滑函数。 缺点: (1)在深度神经网络中梯度反向传递时导致梯度爆炸和梯度消失,其中梯度爆炸发生的概率非常小,而梯度消失发生的概率比较大。 (2)随着网络层数的增加,由于链式法则,连乘的sigmoid函数导数会变得越来越小,导致梯度难以回转,这会降低网络的收敛速率,甚至导致网络不能收敛到好妆态。 2、Tanh函数 torch.nn.Ta..

qq_43642798的博客 1191

Bode图、ABCD矩阵与EET结合:三步搞定复杂电路传递函数分析

在模拟电路与电源控制设计中,传递函数和频率响应是衡量系统稳定性的核心指标。Bode图以直观的幅频/相频曲线揭示带宽与相位裕度,ABCD二端口矩阵可将级联网络结构化表达,而EET额外元素定理则针对寄生电容、负载效应等局部修正提供显式公式。三者互补,组合成一套从整体拓扑到局部寄生修正的完整分析方法:先用ABCD搭建主体网络,再用EET快速加入额外元件,最后用Bode图验证传递函数和稳定裕度。该方法适用于滤波器设计、电源环路补偿、运放稳定性分析等线性小信号场景,支持Python/SciPy和SPICE交叉验证,显

weixin_32496547的博客 363

论文分享|ECCV2022,PATnet,Cross-Domain Few-Shot Semantic Segmentation,CDFSS新基准,文末有复现教程

这篇论文提出的跨域小样本语义分割(CD-FSS)任务,旨在将源域学习的分割能力迁移到目标域,仅需少量标注样本。针对传统小样本分割方法在跨域场景性能下降的问题,作者提出了基于金字塔锚点变换的网络(PATNet),通过将域相关特征转换为域无关特征,并引入任务自适应微调推理(TFI)提升目标域适应能力。实验表明,PATNet在1-shot和5-shot设置下分别比现有方法提升8.49%和10.61%的准确率。同时,作者构建了CD-FSS基准并设计了任务难度评估指标。代码和数据集已开源,复现难度中等。

m0_74277350的博客 1097

[pytorch] 自定义激活函数swish(三)

         在神经网络模型中,激活函数多种多样。大体都是,小于0的部分,进行抑制(即,激活函数输出为非常小的数),大于0的部分,进行放大(即,激活函数输出为较大的数)。         主流的激活函数一般都满足,         1. 非线性。信号处理里,信号通过非线性系统后,能产生新频率的信号。不妨假定,非线性有相似作用。         2. 可微性。可求导的,在反向传播中,可以方便使用...

lingdexixixi的博客 1万+

关于HC32F460 输出可调占空比PWM波遇到的问题记录

文章目录问题记录一、问题分析二、解决方法总结 问题记录 芯片:HC32F460系列 功能:PWM电机调速 最近产品开发,需要用到HC32的PWM输出来控制电机的转速。参考官方的例程很快就完成了相关的功能,但是,后面在测试,重复开关电机的时候,发现电机的转速时大时小。 一、问题分析 一开始,怀疑是相关寄存器的设置出错导致的问题。因此在设置PWM输出时加上LOG打印,上机测试并没有发现问题。 用示波器抓取波形,这是正常状态下的波形(上电默认配置成5kHz,70%占空比输出) 这是转速较小时的波形输出 .

Top0_0lll的博客 6168

【Pytorch神经网络理论篇】 07 激活函数+Sigmoid+tanh+ReLU+Swish+Mish+GELU

①激活函数:主要通过加入非线性因素,你不线性模型表达能力不足的缺陷,因为神经网络中的数学基础是处处可微分的函数,故要求激活函数也应该保证数据的输入与输出是可微分。 ②激活函数可以分为饱和激活函数与不饱和激活函数,激活函数的右饱和指当x xx趋向于正无穷时,函数的导数趋近于0。同样的,当x xx趋向于负无穷时,函数的导数趋近于0,此时称为左饱和。当一个函数既满足右饱和,又满足左饱和,则称为饱和函数,否则称为非饱和函数。 1 Sigmoid函数 对于分类任务来说,如果仅仅给出分类的结果,在某些场景下.

小李的研究生学习日记 8575

初识机会网络仿真器ONE中ExternalMovement移动模型(导入外部移动数据)

最近半个月一直在研究ONE中关于ExternalMovement移动模型的源代码,在网上几乎没有找到相关的资料,很是苦恼,如果有共同研究方向的小伙伴欢迎联系我,共同讨论进步。 下面记录一下几点感悟: 1、使用外部数据的前提是在ONE的配置文件中增加及修改相关代码: Group.movementModel = ExternalMovement ExternalMovement.file = move...

qq_36974792的博客 661

【研发日记】Matlab/Simulink自动生成代码(二)——五种选择结构实现方法

相比C文本类编程语言,Simulink图形化编程语言的优势是逻辑思路和数据流清晰了很多,劣势是程序执行的时序不明确,而且各个模块的配置使编程的灵活度下降了不少,在使用习惯上面总感觉有各种限制。本文就是拆解Simulink中最基础的几个编程模块,发扬它的优势,避开劣势。

Mr.Cssust的博客 3853

【0基础入门Pytorch】Pytorch的简介与安装(Windows)

Windows环境的Pytorch安装教程

Aime5211的博客 1558

常用激活函数(relu,glu,gelu,swish等)

常用激活函数总结,relu,glu,gelu,swish等,并且给出pytorch的调用接口,或pytorch的实现

cdLiang的博客 1万+

海思3516A移植MT7601U编译过程记录

官方地址:https://www.mediatek.com/products/broadbandWifi/mt7601 tar -xjf DPO_MT7601U_LinuxSTA_3.0.0.4_20130913.tar.bz2 cd DPO_MT7601U_LinuxSTA_3.0.0.4_20130913 1> Makefile替换 PLATFORM = HISI_3516A ifeq ($(PLATFORM),HISI_3516A) LINUX_SRC = /home/wbk/test/linu

qq_39048131的博客 1231

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

从实验室到生产:PyTorch模型的Web部署实战指南

你是否曾训练出高精度的PyTorch模型,却困于如何让用户真正用上它?本文将带你突破这一困境,通过Flask/Django框架实现模型的Web化部署,让AI能力从Jupyter Notebook走向真实应用场景。读完本文,你将掌握模型序列化、API构建、性能优化全流程,最终拥有一个可公开访问的图像分类Web应用。 ## 部署前的关键决策:模型选择与评估 在部署前,需明确模型的性能指标与部署目标...

gitblog_00126的博客 578

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain&#39;s apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath(&#39;DeepLearnToolbox&#39;));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand(&#39;state&#39;,0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = &#39;sigm&#39;;%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, &#39;Too big error&#39;);```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, &#39;Too big error&#39;);```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

PyTorch 深度学习笔记(十一):Swish 激活函数的 PyTorch 实现与训练效果验证

Swish 激活函数是 Google 提出的一种新型激活函数,其定义为 $f(x) = x \cdot \sigma(\beta x)$,其中 $\sigma$ 为 Sigmoid 函数,$\beta$ 为可学习的参数。Swish 激活函数在多个任务上表现优于 ReLU 激活函数。Swish 激活函数的 PyTorch 实现有多种方式,可以直接使用内置函数或自定义实现。

2501_93877429的博客 328

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

Pytorch深度学习教程_6_激活函数

Sigmoid、Tanh、ReLU等激活函数的原理与实践

tRNA的博客 1065

Torch.nn.Hardswish

低版本Torch实现 Torch.nn.Hardswish

qq_41848298的博客 905

Pytorch 激活函数

激活函数(activation functions)的目标是,将神经网络非线性化。激活函数是连续的(continuous),且可导的(differential)。 连续的:当输入值发生较小的改变时,输出值也发生较小的改变; 可导的:在定义域中,每一处都是存在导数; 神经网络中比较常用的激活函数有sigmoid、tanh、ReLU,Leaky ReLU、Maxout: 在PyTorch的老...

洪流之源 4939

pytorch hardswish激活函数

Hardswish激活函数,在MobileNetV3架构中被提出,相较于swish函数,具有数值稳定性好,计算速度快等优点,具体原理请参考:https://arxiv.org/pdf/1905.02244.pdf

CV小白的博客 5934
上一篇: 编写代码的软件用什么编写的_编写SimpleAdmin主题的代码:完善
下一篇: css快速写标签_快速提示:创建类似CSS3的票证标签
daique1908
博客等级 码龄10年 29粉丝 0原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值