(1)tf.nn.max_pool()函数

解释:

  1. tf.nn.max_pool(value, ksize, strides, padding, data_format='NHWC', name=None)
  2.  
  3. 需要设置的参数主要有四个:
  4.  
  5. 第一个参数value:需要池化的输入,一般池化层接在卷积层后面,所以输入通常是feature map,依然是[batch, height, width, channels]这样的shape
  6.  
  7. 第二个参数ksize:池化窗口的大小,取一个四维向量,一般是[1, height, width, 1],因为我们不想在batchchannels上做池化,所以这两个维度设为了1
  8.  
  9. 第三个参数strides:和卷积类似,窗口在每一个维度上滑动的步长,一般也是[1, stride,stride, 1]
  10.  
  11. 第四个参数padding:和卷积类似,可以取'VALID' 或者'SAME'
  12.  
  13. 返回一个Tensor,类型不变,shape仍然是[batch, height, width, channels]这种形式

示例:

  1. 程序:
  2.  
  3. import tensorflow as tf
  4.  
  5. a=tf.constant([
  6. [[1.0,2.0,3.0,4.0],
  7. [5.0,6.0,7.0,8.0],
  8. [8.0,7.0,6.0,5.0],
  9. [4.0,3.0,2.0,1.0]],
  10. [[4.0,3.0,2.0,1.0],
  11. [8.0,7.0,6.0,5.0],
  12. [1.0,2.0,3.0,4.0],
  13. [5.0,6.0,7.0,8.0]]
  14. ])
  15.  
  16. a=tf.reshape(a,[1,4,4,2])
  17.  
  18. pooling=tf.nn.max_pool(a,[1,2,2,1],[1,1,1,1],padding='VALID')
  19. with tf.Session() as sess:
  20. print("image:")
  21. image=sess.run(a)
  22. print (image)
  23. print("reslut:")
  24. result=sess.run(pooling)
  25. print (result)
  26.  
  27. 运行结果:
  28.  
  29. image:
  30. [[[[ 1. 2.]
  31. [ 3. 4.]
  32. [ 5. 6.]
  33. [ 7. 8.]]
  34.  
  35. [[ 8. 7.]
  36. [ 6. 5.]
  37. [ 4. 3.]
  38. [ 2. 1.]]
  39.  
  40. [[ 4. 3.]
  41. [ 2. 1.]
  42. [ 8. 7.]
  43. [ 6. 5.]]
  44.  
  45. [[ 1. 2.]
  46. [ 3. 4.]
  47. [ 5. 6.]
  48. [ 7. 8.]]]]
  49. reslut:
  50. [[[[ 8. 7.]
  51. [ 6. 6.]
  52. [ 7. 8.]]
  53.  
  54. [[ 8. 7.]
  55. [ 8. 7.]
  56. [ 8. 7.]]
  57.  
  58. [[ 4. 4.]
  59. [ 8. 7.]
  60. [ 8. 8.]]]]

(2)tf.nn.dropout函数

解释

  1. tf.nn.dropout(x, keep_prob, noise_shape=None, seed=None, name=None)
  2.  
  3. 此函数是为了防止在训练中过拟合的操作,将训练输出按一定规则进行变换
  4.  
  5. 参数:
  6. x:输入
  7. keep_prob:保留比例。 取值 (0,1] 。每一个参数都将按这个比例随机变更
  8. noise_shape:干扰形状。 此字段默认是None,表示第一个元素的操作都是独立,但是也不一定。比例:数据的形状是shape(x)=[k, l, m, n],而noise_shape=[k, 1, 1, n],则第14列是独立保留或删除,第23列是要么全部保留,要么全部删除。
  9. seed:整形变量,随机数种子。
  10. name:名字,没啥用
  11. 返回:Tnesor

(3)tf.nn.local_response_normalization函数

公式说明

local response normalization最早是由Krizhevsky和Hinton在关于ImageNet的论文里面使用的一种数据标准化方法,即使现在,也依然会有不少CNN网络会使用到这种正则手段,现在记录一下lrn方法的计算流程以及tensorflow的实现,方便后面查阅

以上是这种归一手段的公式,其中a的上标指该层的第几个feature map,a的下标x,y表示feature map的像素位置,N指feature map的总数量,公式里的其它参数都是超参,需要自己指定的。

这种方法是受到神经科学的启发,激活的神经元会抑制其邻近神经元的活动(侧抑制现象),至于为什么使用这种正则手段,以及它为什么有效,查阅了很多文献似乎也没有详细的解释,可能是由于后来提出的batch normalization手段太过火热,渐渐的就把local response normalization掩盖了吧

解释:

  1. tf.nn.local_response_normalization(input, depth_radius=5, bias=1, alpha=1, beta=0.5, name=None)
  2.  
  3. 除去name参数用以指定该操作的name,与方法有关的一共五个参数:
  4.  
  5. 第一个参数input:这个输入就是feature map了,既然是feature map,那么它就具有[batch, height, width, channels]这样的shape
  6. 第二个参数depth_radius:这个值需要自己指定,就是上述公式中的n/2
  7. 第三个参数bias:上述公式中的k
  8. 第四个参数alpha:上述公式中的α
  9. 第五个参数beta:上述公式中的β

程序

  1. import tensorflow as tf
  2.  
  3. a = tf.constant([
  4. [[1.0, 2.0, 3.0, 4.0],
  5. [5.0, 6.0, 7.0, 8.0],
  6. [8.0, 7.0, 6.0, 5.0],
  7. [4.0, 3.0, 2.0, 1.0]],
  8. [[4.0, 3.0, 2.0, 1.0],
  9. [8.0, 7.0, 6.0, 5.0],
  10. [1.0, 2.0, 3.0, 4.0],
  11. [5.0, 6.0, 7.0, 8.0]]
  12. ])
  13. #reshape a,get the feature map [batch:1 height:2 width:2 channels:8]
  14. a = tf.reshape(a, [1, 2, 2, 8])
  15.  
  16. normal_a=tf.nn.local_response_normalization(a,2,0,1,1)
  17. with tf.Session() as sess:
  18. print("feature map:")
  19. image = sess.run(a)
  20. print (image)
  21. print("normalized feature map:")
  22. normal = sess.run(normal_a)
  23. print (normal)

输出结果:

  1. feature map:
  2. [[[[ 1. 2. 3. 4. 5. 6. 7. 8.]
  3. [ 8. 7. 6. 5. 4. 3. 2. 1.]]
  4.  
  5. [[ 4. 3. 2. 1. 8. 7. 6. 5.]
  6. [ 1. 2. 3. 4. 5. 6. 7. 8.]]]]
  7. normalized feature map:
  8. [[[[ 0.07142857 0.06666667 0.05454545 0.04444445 0.03703704 0.03157895
  9. 0.04022989 0.05369128]
  10. [ 0.05369128 0.04022989 0.03157895 0.03703704 0.04444445 0.05454545
  11. 0.06666667 0.07142857]]
  12.  
  13. [[ 0.13793103 0.10000001 0.0212766 0.00787402 0.05194805 0.04
  14. 0.03448276 0.04545454]
  15. [ 0.07142857 0.06666667 0.05454545 0.04444445 0.03703704 0.03157895
  16. 0.04022989 0.05369128]]]]

(4)tf.get_variable函数

函数定义:

  1. get_variable(
  2. name,
  3. shape=None,
  4. dtype=None,
  5. initializer=None,
  6. regularizer=None,
  7. trainable=True,
  8. collections=None,
  9. caching_device=None,
  10. partitioner=None,
  11. validate_shape=True,
  12. use_resource=None,
  13. custom_getter=None
  14. )

其中参数分别为:

  1. 参数:
  2. name:新变量或现有变量的名称。
  3.  
  4. shape:新变量或现有变量的形状。
  5.  
  6. dtype:新变量或现有变量的类型(默认为 DT_FLOAT)。
  7.  
  8. initializer:创建变量的初始化器。
  9.  
  10. regularizer:一个函数(张量 - >张量或无);将其应用于新创建的变量的结果将被添加到集合 tf.GraphKeys.REGULARIZATION_LOSSES 中,并可用于正则化。
  11.  
  12. trainable:如果为 True,还将变量添加到图形集合:GraphKeys.TRAINABLE_VARIABLES
  13. collections:要将变量添加到其中的图形集合键的列表。默认为 [GraphKeys.LOCAL_VARIABLES]。
  14.  
  15. caching_device:可选的设备字符串或函数,描述变量应该被缓存以读取的位置。默认为变量的设备,如果不是 None,则在其他设备上进行缓存。典型的用法的在使用该变量的操作所在的设备上进行缓存,通过 Switch 和其他条件语句来复制重复数据删除。
  16.  
  17. partitioner:(可选)可调用性,它接受要创建的变量的完全定义的 TensorShape dtype,并且返回每个坐标轴的分区列表(当前只能对一个坐标轴进行分区)。
  18.  
  19. validate_shape:如果为假,则允许使用未知形状的值初始化变量。如果为真,则默认情况下,initial_value 的形状必须是已知的。
  20. use_resource:如果为假,则创建一个常规变量。如果为真,则创建一个实验性的 ResourceVariable,而不是具有明确定义的语义。默认为假(稍后将更改为真)。
  21.  
  22. custom_getter:可调用的,将第一个参数作为真正的 getter,并允许覆盖内部的 get_variable 方法。custom_getter 的签名应该符合这种方法,但最经得起未来考验的版本将允许更改:def custom_getter(getter, *args, **kwargs)。还允许直接访问所有 get_variable 参数:def custom_getter(getter, name, *args, **kwargs)。创建具有修改的名称的变量的简单标识自定义 getter 是:python def custom_getter(getter, name, *args, **kwargs): return getter(name + '_suffix', *args, **kwargs)

使用例子

  1. w = tf.get_variable("w", shape = [inputD, outputD], dtype = "float")
  2. b = tf.get_variable("b", [outputD], dtype = "float")

(5)tf.variable_scope函数

函数原理

用于定义创建变量(层)的操作的上下文管理器。
此上下文管理器验证(可选)values是否来自同一图形,确保图形是默认的图形,并推送名称范围和变量范围。
如果name_or_scope不是None,则使用as is。如果scope是None,则使用default_name。在这种情况下,如果以前在同一范围内使用过相同的名称,则通过添加_N来使其具有唯一性。
变量范围允许您创建新变量并共享已创建的变量,同时提供检查以防止意外创建或共享。在本文中我们提供了几个基本示例。

如何创建一个新变量:

  1. with tf.variable_scope("foo"):
  2. with tf.variable_scope("bar"):
  3. v = tf.get_variable("v", [1])
  4. assert v.name == "foo/bar/v:0"

(6)tf.nn.relu函数

解释

这个函数的作用是计算激活函数relu,即max(features, 0)。即将矩阵中每行的非最大值置0。

类似的还有tf.sigmoid , tf.tanh

函数定义:

  1. >>> help(tf.nn.relu)
  2. Help on function relu in module tensorflow.python.ops.gen_nn_ops:
  3.  
  4. relu(features, name=None)
  5. Computes rectified linear: `max(features, 0)`.
  6.  
  7. Args:
  8. features: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `uint8`, `int16`, `int8`, `int64`, `bfloat16`, `uint16`, `half`, `uint32`, `uint64`.
  9. name: A name for the operation (optional).
  10.  
  11. Returns:
  12. A `Tensor`. Has the same type as `features`.

程序示例

  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. import tensorflow as tf
  5.  
  6. a = tf.constant([-1.0, 2.0])
  7. with tf.Session() as sess:
  8. b = tf.nn.relu(a)
  9. print sess.run(b)

运行结果:

  1. [0. 2.]

(7)tf.nn.bias_add函数

函数定义

  1. tf.nn.bias_add(value, bias, data_format=None, name=None)
  2.  
  3. value加一偏置量
  4. 此函数为tf.add的特殊情况,bias仅为一维,
  5. 函数通过广播机制进行与value求和,
  6. 数据格式可以与value不同,返回为与value相同格式

官方释义:

  1. >>> help(tf.nn.bias_add)
  2. Help on function bias_add in module tensorflow.python.ops.nn_ops:
  3.  
  4. bias_add(value, bias, data_format=None, name=None)
  5. Adds `bias` to `value`.
  6.  
  7. This is (mostly) a special case of `tf.add` where `bias` is restricted to 1-D.
  8. Broadcasting is supported, so `value` may have any number of dimensions.
  9. Unlike `tf.add`, the type of `bias` is allowed to differ from `value` in the
  10. case where both types are quantized.
  11.  
  12. Args:
  13. value: A `Tensor` with type `float`, `double`, `int64`, `int32`, `uint8`,
  14. `int16`, `int8`, `complex64`, or `complex128`.
  15. bias: A 1-D `Tensor` with size matching the last dimension of `value`.
  16. Must be the same type as `value` unless `value` is a quantized type,
  17. in which case a different quantized type may be used.
  18. data_format: A string. 'NHWC' and 'NCHW' are supported.
  19. name: A name for the operation (optional).
  20.  
  21. Returns:
  22. A `Tensor` with the same type as `value`.

使用示例:

  1. out = tf.nn.bias_add(mergeFeatureMap, b)

(8)tf.nn.xw_plus_b函数

官方解释:

  1. >>> help(tf.nn.xw_plus_b)
  2. Help on function xw_plus_b in module tensorflow.python.ops.nn_ops:
  3.  
  4. xw_plus_b(x, weights, biases, name=None)
  5. Computes matmul(x, weights) + biases.
  6.  
  7. Args:
  8. x: a 2D tensor. Dimensions typically: batch, in_units
  9. weights: a 2D tensor. Dimensions typically: in_units, out_units
  10. biases: a 1D tensor. Dimensions: out_units
  11. name: A name for the operation (optional). If not specified
  12. "xw_plus_b" is used.
  13.  
  14. Returns:
  15. A 2-D Tensor computing matmul(x, weights) + biases.
  16. Dimensions typically: batch, out_units.

使用示例:

  1. out = tf.nn.xw_plus_b(x, w, b, name = scope.name)

解释:

xw_plus_b(x, weights, biases, name=None)相当于matmul(x, weights) + biases.

(9)tf.nn.conv2d函数

官方解释:

  1. >>> help(tf.nn.conv2d)
  2. Help on function conv2d in module tensorflow.python.ops.gen_nn_ops:
  3.  
  4. conv2d(input, filter, strides, padding, use_cudnn_on_gpu=True, data_format='NHWC', dilations=[1, 1, 1, 1], name=None)
  5. Computes a 2-D convolution given 4-D `input` and `filter` tensors.
  6.  
  7. Given an input tensor of shape `[batch, in_height, in_width, in_channels]`
  8.  
  9. and a filter / kernel tensor of shape
  10.  
  11. `[filter_height, filter_width, in_channels, out_channels]`, this op
  12.  
  13. performs the following:
  14.  
  15. 1. Flattens the filter to a 2-D matrix with shape
  16.  
  17. `[filter_height * filter_width * in_channels, output_channels]`.
  18.  
  19. 2. Extracts image patches from the input tensor to form a *virtual*
  20.  
  21. tensor of shape `[batch, out_height, out_width,
  22.  
  23. filter_height * filter_width * in_channels]`.
  24.  
  25. 3. For each patch, right-multiplies the filter matrix and the image patch
  26.  
  27. vector.
  28.  
  29. In detail, with the default NHWC format,
  30.  
  31. output[b, i, j, k] =
  32.  
  33. sum_{di, dj, q} input[b, strides[1] * i + di, strides[2] * j + dj, q] *
  34.  
  35. filter[di, dj, q, k]
  36.  
  37. Must have `strides[0] = strides[3] = 1`. For the most common case of the same
  38.  
  39. horizontal and vertices strides, `strides = [1, stride, stride, 1]`.
  40.  
  41. Args:
  42. input: A `Tensor`. Must be one of the following types: `half`, `bfloat16`, `float32`.
  43. A 4-D tensor. The dimension order is interpreted according to the value
  44.  
  45. of `data_format`, see below for details.
  46. filter: A `Tensor`. Must have the same type as `input`.
  47. A 4-D tensor of shape
  48.  
  49. `[filter_height, filter_width, in_channels, out_channels]`
  50. strides: A list of `ints`.
  51. 1-D tensor of length 4. The stride of the sliding window for each
  52.  
  53. dimension of `input`. The dimension order is determined by the value of
  54.  
  55. `data_format`, see below for details.
  56. padding: A `string` from: `"SAME", "VALID"`.
  57. The type of padding algorithm to use.
  58. use_cudnn_on_gpu: An optional `bool`. Defaults to `True`.
  59. data_format: An optional `string` from: `"NHWC", "NCHW"`. Defaults to `"NHWC"`.
  60. Specify the data format of the input and output data. With the
  61.  
  62. default format "NHWC", the data is stored in the order of:
  63.  
  64. [batch, height, width, channels].
  65.  
  66. Alternatively, the format could be "NCHW", the data storage order of:
  67.  
  68. [batch, channels, height, width].
  69. dilations: An optional list of `ints`. Defaults to `[1, 1, 1, 1]`.
  70. 1-D tensor of length 4. The dilation factor for each dimension of
  71.  
  72. `input`. If set to k > 1, there will be k-1 skipped cells between each
  73.  
  74. filter element on that dimension. The dimension order is determined by the
  75.  
  76. value of `data_format`, see above for details. Dilations in the batch and
  77.  
  78. depth dimensions must be 1.
  79. name: A name for the operation (optional).
  80.  
  81. Returns:
  82. A `Tensor`. Has the same type as `input`.

函数释义

  1. 此函数的作用是在给定四维输入(input)和权重Wfilter)的情况下计算二维卷积。
  2.  
  3. 参数解释:
  4. input
  5. 一个Tensor,每个元素的格式必须为float32float64.
  6. input的形状:[batch,in_height,in_width,in_channels],
  7. batch为训练过程中每迭代一次迭代的照片数。
  8. in_height,in_width分别为图片的高和宽
  9. in_channels为图片的道。
  10. filter
  11. 一个Tensor,每个元素的类型和input类型一致。
  12. filter的形状:[filter_height,filter_width,in_channels,out_channels]
  13. 分别为权重的heightwidth,输入的channels和输出的channels
  14. stride
  15. 长度为4list,元素类型为int。表示每一维度滑动的步长。
  16. 需要注意的是,strides[0]=strides[3]=1.
  17. padding
  18. 可选参数为"Same","VALID"
  19. 边距,一般设为0,即padding='SAME'
  20. use_cudnn_on_gpu:
  21. bool类型,有TrueFalse两种选择。
  22. name
  23. 此操作的名字
  1. 函数执行以下操作:
  2. 1.将参数filter变为一个二维矩阵,形状为:[filter_height*filter_width*in_channels,output_channels]
  3. 2.将输入(input)转化为一个具有如下形状的Tensor,形状为:[batch,out_height,out_width,filter_height * filter_width * in_channels]
  4. 3.filter矩阵和步骤2得到的矩阵相乘。

函数的返回值:
元素类型和input相同。

  1. output[b, i, j, k] =sum_{di, dj, q} input[b, strides[1] * i + di, strides[2] * j + dj, q] * filter[di, dj, q, k]

编程示例:

  1. kernel = tf.Variable(tf.truncated_normal([3,3,384,256], dtype=tf.float32, stddev=1e-1), name='weights')
  2. conv = tf.nn.conv2d(conv3, kernel, [1,1,1,1],padding='SAME')

(10)tf.constant函数

官方解释:

  1. >>> help(tf.constant)
  2. Help on function constant in module tensorflow.python.framework.constant_op:
  3.  
  4. constant(value, dtype=None, shape=None, name='Const', verify_shape=False)
  5. Creates a constant tensor.
  6.  
  7. The resulting tensor is populated with values of type `dtype`, as
  8. specified by arguments `value` and (optionally) `shape` (see examples
  9. below).
  10.  
  11. The argument `value` can be a constant value, or a list of values of type
  12. `dtype`. If `value` is a list, then the length of the list must be less
  13. than or equal to the number of elements implied by the `shape` argument (if
  14. specified). In the case where the list length is less than the number of
  15. elements specified by `shape`, the last element in the list will be used
  16. to fill the remaining entries.
  17.  
  18. The argument `shape` is optional. If present, it specifies the dimensions of
  19. the resulting tensor. If not present, the shape of `value` is used.
  20.  
  21. If the argument `dtype` is not specified, then the type is inferred from
  22. the type of `value`.
  23.  
  24. For example:
  25.  
  26. ```python
  27. # Constant 1-D Tensor populated with value list.
  28. tensor = tf.constant([1, 2, 3, 4, 5, 6, 7]) => [1 2 3 4 5 6 7]
  29.  
  30. # Constant 2-D tensor populated with scalar value -1.
  31. tensor = tf.constant(-1.0, shape=[2, 3]) => [[-1. -1. -1.]
  32. [-1. -1. -1.]]
  33. ```
  34.  
  35. Args:
  36. value: A constant value (or list) of output type `dtype`.
  37.  
  38. dtype: The type of the elements of the resulting tensor.
  39.  
  40. shape: Optional dimensions of resulting tensor.
  41.  
  42. name: Optional name for the tensor.
  43.  
  44. verify_shape: Boolean that enables verification of a shape of values.
  45.  
  46. Returns:
  47. A Constant Tensor.
  48.  
  49. Raises:
  50. TypeError: if shape is incorrectly specified or unsupported.

程序示例:

https://blog.csdn.net/qq_26591517/article/details/80198471

tensorflow构建CNN模型时的常用接口函数的更多相关文章

  1. keras训练cnn模型时loss为nan

    keras训练cnn模型时loss为nan 1.首先记下来如何解决这个问题的:由于我代码中 model.compile(loss='categorical_crossentropy', optimiz ...

  2. FaceRank-人脸打分基于 TensorFlow 的 CNN 模型

    FaceRank-人脸打分基于 TensorFlow 的 CNN 模型 隐私 因为隐私问题,训练图片集并不提供,稍微可能会放一些卡通图片. 数据集 130张 128*128 张网络图片,图片名: 1- ...

  3. keras: 在构建LSTM模型时,使用变长序列的方法

    众所周知,LSTM的一大优势就是其能够处理变长序列.而在使用keras搭建模型时,如果直接使用LSTM层作为网络输入的第一层,需要指定输入的大小.如果需要使用变长序列,那么,只需要在LSTM层前加一个 ...

  4. Tensorflow中保存模型时生成的各种文件区别和作用

    假如我们得到了如下的checkpoints, 上面的文件主要可以分成三类:一种是在保存模型时生成的文件,一种是我们在使用tensorboard时生成的文件,还有一种就是plugins这个文件夹,这个是 ...

  5. 基于Spark和Tensorflow构建DCN模型进行CTR预测

    实验介绍 数据采用Criteo Display Ads.这个数据一共11G,有13个integer features,26个categorical features. Spark 由于数据比较大,且只 ...

  6. QList模板类常用接口函数

    插入操作:insert()函数原型:void QList::insert(int i, const T &value) 在索引后插入值 i:索引 value:插入值 Example: QLis ...

  7. TensorFlow常用的函数

    TensorFlow中维护的集合列表 在一个计算图中,可以通过集合(collection)来管理不同类别的资源.比如通过 tf.add_to_collection 函数可以将资源加入一个 或多个集合中 ...

  8. TensorFlow 常用的函数

    TensorFlow 中维护的集合列表 在一个计算图中,可以通过集合(collection)来管理不同类别的资源.比如通过 tf.add_to_collection 函数可以将资源加入一个或多个集合中 ...

  9. mysql时间类型总结及常用时间函数

    日期时间和类型 常用日期和时间类型 字节 year                1       表示年份                   值范围:(1901----2155) date     ...

随机推荐

  1. 洛谷P1342 请柬

    P1342 请柬 题目描述 在电视时代,没有多少人观看戏剧表演.Malidinesia古董喜剧演员意识到这一事实,他们想宣传剧院,尤其是古色古香的喜剧片.他们已经打印请帖和所有必要的信息和计划.许多学 ...

  2. 洛谷P3258 [JLOI2014]松鼠的新家

    P3258 [JLOI2014]松鼠的新家 题目描述 松鼠的新家是一棵树,前几天刚刚装修了新家,新家有n个房间,并且有n-1根树枝连接,每个房间都可以相互到达,且俩个房间之间的路线都是唯一的.天哪,他 ...

  3. dbms_xplan的display_cursor查看执行计划

    准备工作: SQL> conn sys/root as sysdba Connected. SQL> grant select on v_$sql_plan to scott; Grant ...

  4. 洛谷P1057 传球游戏(记忆化搜索)

    点我进入题目 题目大意:n个小孩围一圈传球,每个人可以给左边的人或右边的人传球,1号小孩开始,一共传m次,请问有多少种可能的路径使球回到1号小孩. 输入输出:输入n,m,输出路径的数量. 数据范围:4 ...

  5. mysql中group by分组

    为了测试group by语句,我们首先创建一个表: 然后向表内添加数据: 然后我们查看一下表的内容 接着我们分别按照性别和年龄对这个表进行分组; 我们可以看到表内的数据没有原表的多了,原因就是分组有去 ...

  6. 「BZOJ3600」没有人的算术 替罪羊树+线段树

    题目描述 过长--不想发图也不想发文字,所以就发链接吧-- 没有人的算术 题解 \(orz\)神题一枚 我们考虑如果插入的数不是数对,而是普通的数,这就是一道傻题了--直接线段树一顿乱上就可以了. 于 ...

  7. idea中使用Git对项目进行版本控制

  8. iOS无线真机调试

    打开xcode,选择Window > Devices and Simulators 用数据线连接设备 选择 Connect via network

  9. 兼容IE的login表单巧妙写法

    利用label来写: HTML: <div class="loginwrap"> <label for="phonenumber" class ...

  10. P2062 分队问题(贪心orDP)

    题目描述 给定n个选手,将他们分成若干只队伍.其中第i个选手要求自己所属的队伍的人数大等于a[i]人. 在满足所有选手的要求的前提下,最大化队伍的总数. 注:每个选手属于且仅属于一支队伍. 输入输出格 ...