torch.mm(mat1, mat2) performs a matrix multiplication of mat1 and mat2 a = torch.randint(0, 5, (2, 3)) # tensor([[3, 3, 2], # [2, 2, 2]]) b = torch.ra ...
分类:
其他好文 时间:
2020-04-30 19:10:56
阅读次数:
51
摘要 1. Logistic回归分类 2. 梯度下降法 3. 代码实现与解释 Logistic回归 逻辑斯特回归(logistic regression)是一种非常经典的分类方法。其用到的分类函数一般为Sigmoid函数,其函数形式为: 其图形表示如下: 从图中我们可以看到,当z=0时,函数值为0. ...
分类:
其他好文 时间:
2020-04-29 18:40:46
阅读次数:
77
This time your job is to fill a sequence of N positive integers into a spiral matrix in non-increasing order. A spiral matrix is filled in from the fi ...
分类:
其他好文 时间:
2020-04-28 00:48:51
阅读次数:
67
给定 matrix = [ [1,2,3], [4,5,6], [7,8,9]], 原地旋转输入矩阵,使其变为:[ [7,4,1], [8,5,2], [9,6,3]] class Solution(object): def rotate(self, matrix): """ :type matri ...
分类:
其他好文 时间:
2020-04-28 00:07:29
阅读次数:
59
本文始发于个人公众号: TechFlow ,原创不易,求个关注 今天是LeetCode专题的第32篇文章,我们一起看的是LeetCode的第54题——Spiral Matrix。 首先解释一下题意,这个Spiral是螺旋的意思,据说英文版的漫画里,把鸣人的螺旋丸就翻译成Spiral Sphere.. ...
分类:
其他好文 时间:
2020-04-27 22:45:01
阅读次数:
69
Given a matrix of integers A with R rows and C columns, find the maximum score of a path starting at [0,0] and ending at [R-1,C-1]. The score of a pat ...
分类:
其他好文 时间:
2020-04-27 09:21:15
阅读次数:
58
布尔矩阵及其运算 概念: 布尔矩阵(boolean matrix)或叫位矩阵(bit matrix)是元素为0或1的矩阵; 运算: 1,补(compiement) 设A=[aij]是一个m×n的布尔矩阵,补就是把原矩阵中的0变为1,1变为0; 2,并(join) 设A=[aij],B=[bij],是 ...
分类:
其他好文 时间:
2020-04-25 01:25:41
阅读次数:
137
opengl算法学习 直线绘制 DDA方法 DDA方法(Digital Differential Analyzer)是一种线段扫描转换算法,在一个坐标轴上以单位间隔对线段取样,从而确定另一个坐标轴上最靠近线路径的对应整数值。 方法概述 假设已知直线两端点$A(x_{a},y_{a})$,$B(x_{ ...
分类:
编程语言 时间:
2020-04-23 00:41:37
阅读次数:
84
Description 求 $\sum_{i=x1}^{x2}\sum_{j=y1}^{y2}C[i][j]\%p$。 Solution 组合数有一个式子:$C[i][j]=C[i 1][j 1]+C[i 1][j]$。 我们可以这样理解一下这个式子:这是一个前缀和,如果我们先枚举 j 再枚举 i, ...
分类:
其他好文 时间:
2020-04-22 16:13:05
阅读次数:
48
* HELM -- Help Engineer Learn Math** introProduction of this 2015 edition, containingcorrections and minor revisionsof the 2008 edition,was funded by ...
分类:
其他好文 时间:
2020-04-20 21:18:59
阅读次数:
79