自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(8)
  • 收藏
  • 关注

原创 pytorch中使用detach()

import torch.nn as nnimport torchclass net(nn.Module): def __init__(self): super().__init__() self.conv = nn.Conv2d(3, 6, 3, stride=2, padding=1) self.layer1 = nn.Conv2d...

2018-11-29 10:43:55 4448

原创 np.random.choice 参数replace

replace = True 在一次抽取中,抽取的样本可重复出现。 即:np.random.choice(6, 2, replace=True) 可得,array( [4, 4] ) replace = False 再一次抽取中,抽样的样本不可重复出现。 即:不可得 array( [4, 4] ),array( [1, 1] )等等。

2017-05-04 19:00:46 3140 1

原创 作业分配(回溯法)

有n份作业分配给n个人去完成,每人完成一份作业。假定第i个人完成第j份作业需要花费cij时间, cij>0,1≦i,j≦n。试设计一个回溯算法,将n份作业分配给n个人完成,使得总花费时间最短。 C++实现:/* * Author: qinwu * Created Time: 2017/4/30 22:45:25 * File Name: Solution.cpp */#include

2017-05-01 12:01:29 3132

原创 存在障碍的点到点路径和问题(动态规划)

63. Unique Paths II 原地解法:class Solution {public: int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) { int m = obstacleGrid.size(); int n = obstacleGrid[0].size()

2017-04-18 14:53:08 916 1

原创 点到点路径和问题(动态规划)

62. Unique Paths 求解Start到Finish路径的总和,只允许从起点位置向下或者向右移动。 设v为路径统计矩阵,v[i][j]为经过i,j位置的路径总数。 状态转移方程:v[i][j] = v[i-1][j] + v[i][j-1];class Solution {public: int uniquePaths(int m, int n) { v

2017-04-18 13:09:53 1166 1

原创 数字序列全组合(递归)

78. Subsetsclass Solution {public: vector<vector<int>> subsets(vector<int>& nums) { vector<vector<int> > v; vector<int> temp; int length = nums.size(); for(int

2017-04-13 14:09:35 1069 1

原创 二叉树的建立(先序+中序)

105. Construct Binary Tree from Preorder and Inorder Traversal/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNo

2017-04-10 14:02:44 286 1

原创 二叉树的建立(后序+中序)

106. Construct Binary Tree from Inorder and Postorder Traversal/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeN

2017-04-10 13:57:59 406 1

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除