关于tf.gather函数batch_dims参数用法的理解

news2024/9/23 11:19:58

关于tf.gather函数batch_dims参数用法的理解

  • 0 前言
  • 1. 不考虑batch_dims
  • 2. 批处理(考虑batch_dims)
    • 2.1 batch_dims=1
    • 2.2 batch_dims=0
    • 2.3 batch_dims>=2
    • 2.4 batch_dims再降为1
    • 2.5 再将axis降为1
    • 2.6 batch_dims<0
    • 2.7 batch_dims总结
  • 3. 补充
  • 4. 参数和返回值
  • 5. 其他相关论述
  • 6. 附件

截至发稿(2023年3月2日)之前,全网对这个问题的解释都不是很清楚(包括官网和英文互联网),尤其是对batch_dims本质物理含义的解释,以下内容根据tf.gather官网进行翻译,并补充。

0 前言

根据索引indices从参数 axis 轴收集切片。 (弃用的参数,应该指下文的validate_indices

tf.gather(
    params, indices, validate_indices=None, axis=None, batch_dims=0, name=None
)

已弃用:一些参数已弃用:(validate_indices)。 它们将在未来的版本中被删除。 更新说明: validate_indices参数无效。 索引(indices)总是在 CPU 上验证,从不在 GPU 上验证。

1. 不考虑batch_dims

根据索引indices从轴参数axis收集切片。indices必须是任意维度(通常是1-D)的整数张量。

Tensor.getitem适用于标量、tf.newaxis 和 python切片

tf.gather 扩展索引功能以处理索引(indices)张量。

在最简单的情况下,它与标量索引功能相同:

>>> params = tf.constant(['p0', 'p1', 'p2', 'p3', 'p4', 'p5'])
>>> params[3].numpy()
b'p3'
>>> tf.gather(params, 3).numpy()
b'p3'

最常见的情况是传递索引的单轴张量(这不能表示为python切片,因为索引不是连续的):

>>> indices = [2, 0, 2, 5]
>>> tf.gather(params, indices).numpy()
array([b'p2', b'p0', b'p2', b'p5'], dtype=object)

过程如下图所示:
在这里插入图片描述
索引可以有任何形状(shape)。 当参数params有 1 个轴(axis)时,输出形状等于输入形状:

>>> tf.gather(params, [[2, 0], [2, 5]]).numpy()
array([[b'p2', b'p0'],
[b'p2', b'p5']], dtype=object)

参数params也可以有任何形状。 gather 可以根据参数axis(默认为 0)在任何轴(axis)上选择切片。 它下面例程用于收集(gather)矩阵中的第一行,然后是列:

>>> params = tf.constant([[0, 1.0, 2.0],
...                       [10.0, 11.0, 12.0],
...                       [20.0, 21.0, 22.0],
...                       [30.0, 31.0, 32.0]])
>>> tf.gather(params, indices=[3,1]).numpy()
array([[30., 31., 32.],
              [10., 11., 12.]], dtype=float32)
>>> tf.gather(params, indices=[2,1], axis=1).numpy()
array([[ 2., 1.],
              [12., 11.],
              [22., 21.],
              [32., 31.]], dtype=float32)

更一般地说:输出形状与输入形状相同,索引轴(indexed-axis)由索引(indices)的形状代替。

>>> def result_shape(p_shape, i_shape, axis=0):
...   return p_shape[:axis] + i_shape + p_shape[axis+1:]
>>> 
>>> result_shape([1, 2, 3], [], axis=1)
[1, 3]
>>> result_shape([1, 2, 3], [7], axis=1)
[1, 7, 3]
>>> result_shape([1, 2, 3], [7, 5], axis=1)
[1, 7, 5, 3]

例如下面的例程:

>>> params.shape.as_list()
[4, 3]
>>> indices = tf.constant([[0, 2]])
>>> tf.gather(params, indices=indices, axis=0).shape.as_list()
[1, 2, 3]
>>> tf.gather(params, indices=indices, axis=1).shape.as_list()
[4, 1, 2]
>>> params = tf.random.normal(shape=(5, 6, 7, 8))
>>> indices = tf.random.uniform(shape=(10, 11), maxval=7, dtype=tf.int32)
>>> result = tf.gather(params, indices, axis=2)
>>> result.shape.as_list()
[5, 6, 10, 11, 8]

这是因为每个索引都从params中获取一个切片,并将其放置在输出中的相应位置。 对于上面的例子

>>> # For any location in indices
>>> a, b = 0, 1
>>> tf.reduce_all(
...     # the corresponding slice of the result
...     result[:, :, a, b, :] ==
...     # is equal to the slice of `params` along `axis` at the index.
...     params[:, :, indices[a, b], :]
...  ).numpy()
True

除此之外,我们再给indices增加一个元素,当进行gather的时候是沿着paramsaxis=1的上一个维度的元素进行循环的。即paramsaxis=0的元素分别为[0, 1.0, 2.0][10.0, 11.0, 12.0][20.0, 21.0, 22.0][30.0, 31.0, 32.0],然后逐次对这四个元素里面的paramsaxis=1的元素进行取indices对应的元素,四次循环完成整个gather

>>> tf.gather(params, indices=[[2,1], [1,0]], axis=1).numpy()
array([[[ 2.,  1.],
        [ 1.,  0.]],
       [[12., 11.],
        [11., 10.]],
       [[22., 21.],
        [21., 20.]],
       [[32., 31.],
        [31., 30.]]], dtype=float32)

2. 批处理(考虑batch_dims)

batch_dims参数可以让您从批次的每个元素中收集不同的项目。

ps:
可以先直接跳到到2.7 batch_dims总结,前后对照阅读。

2.1 batch_dims=1

使用batch_dims=1相当于在paramsindices的第一个轴(是指axis=0轴)上有一个外循环(在axis=0轴上的元素上进行循环):

>>> params = tf.constant([
...     [0, 0, 1, 0, 2],
...     [3, 0, 0, 0, 4],
...     [0, 5, 0, 6, 0]])
>>> indices = tf.constant([
...     [2, 4],
...     [0, 4],
...     [1, 3]])
>>> tf.gather(params, indices, axis=1, batch_dims=1).numpy()
array([[1, 2],
[3, 4],
[5, 6]], dtype=int32)

等价于:

>>> def manually_batched_gather(params, indices, axis):
...            batch_dims=1
...            result = []
...            for p,i in zip(params, indices):  # 这就是上文所说的外循环
...                   r = tf.gather(p, i, axis=axis-batch_dims)
...                   result.append(r)
...            return tf.stack(result)
>>> manually_batched_gather(params, indices, axis=1).numpy()
array([[1, 2],
             [3, 4],
             [5, 6]], dtype=int32)

接下来将循环里zip的结果打印如下,说明外循环将paramsindices在第一个轴上先zip成三个元组

pprint(list(zip(params.numpy().tolist(), indices.numpy().tolist())))
# [([0, 0, 1, 0, 2], [2, 4]), 
# ([3, 0, 0, 0, 4], [0, 4]), 
# ([0, 5, 0, 6, 0], [1, 3])]

然后分别对[0, 0, 1, 0, 2][2, 4][3, 0, 0, 0, 4][0, 4][0, 5, 0, 6, 0][1, 3],沿着重组之后的axis = 0(即重组之前的axis = 1,这就是为什么后面所说的必须axis>=batch_dims)进行gather

2.2 batch_dims=0

所以可以总结:batch_dims是指最终对哪一个维度的张量进行对照gather,所以当batch_dims=0时,实际上就是将两个整个张量组包,也就是上面第一阶段的省略batch_dims的状态。

此时,相当于将两个张量在外面添加一个维度之后再zip,相当于没zip直接gather。所以,以下两条指令等价,因为batch_dims默认值为0

params = tf.constant([[  # 相对于上文该张量增加了一个维度
    [0, 0, 1, 0, 2],
    [3, 0, 0, 0, 4],
    [0, 5, 0, 6, 0]]])
indices = tf.constant([[  # 相对于上文该张量增加了一个维度
    [2, 4],
    [0, 4],
    [1, 3]]])
pprint(list(zip(params.numpy().tolist(), indices.numpy().tolist())))
# [([[0, 0, 1, 0, 2], [3, 0, 0, 0, 4], [0, 5, 0, 6, 0]],
#   [[2, 4], [0, 4], [1, 3]])]

tf.gather(params, indices, axis=1, batch_dims=0).numpy()
# 等价于
tf.gather(params, indices, axis=1).numpy()
# 输出结果为
# array([[[1, 2],
#         [0, 2],
#         [0, 0]],
# 
#        [[0, 4],
#         [3, 4],
#         [0, 0]],
# 
#        [[0, 0],
#         [0, 0],
#         [5, 6]]], dtype=int32)

2.3 batch_dims>=2

较高的batch_dims值相当于在paramsindices的外轴上进行多个嵌套循环。 所以整体形状函数是

>>> def batched_result_shape(p_shape, i_shape, axis=0, batch_dims=0):
...             return p_shape[:axis] + i_shape[batch_dims:] + p_shape[axis+1:]

>>> batched_result_shape(
...              p_shape=params.shape.as_list(),
...              i_shape=indices.shape.as_list(),
...              axis=1,
...              batch_dims=1)
[3, 2]
>>> tf.gather(params, indices, axis=1, batch_dims=1).shape.as_list()
[3, 2]

举例来说,paramsindices升高一个维度,即batch_dims=2,这时按照约束条件只能axis=2

params = tf.constant([  # 升高一个维度
    [[0, 0, 1, 0, 2],
     [3, 0, 0, 0, 4],
     [0, 5, 0, 6, 0]],

    [[1, 8, 4, 2, 2],
     [9, 6, 2, 3, 0],
     [7, 2, 8, 6, 3]]])
indices = tf.constant([  # 升高一个维度
    [[2, 4],
     [0, 4],
     [1, 3]],

    [[1, 3],
     [2, 1],
     [4, 2]]])
# 进行batch_dims高值gather计算
tf.gather(params, indices, axis=2, batch_dims=2).numpy()
# 则上面的运算等价于
def manually_batched_gather_3d(params, indices, axis):
  batch_dims=2
  result = []
  for p,i in zip(params, indices):  # 这里面进行了batch_dims层(也就是2层)嵌套for循环
      result_2 = []
      for p_2, i_2 in zip(p,i):
          r = tf.gather(p_2, i_2, axis=axis-batch_dims)  # 这里告诉我们为什么axis必须>=batch_dims
          result_2.append(r)
      result.append(result_2)
  return tf.stack(result)
manually_batched_gather_3d(params, indices, axis=2).numpy()
# array([[[1, 2],
#         [3, 4],
#         [5, 6]],
#
#        [[8, 2],
#         [2, 6],
#         [3, 8]]], dtype=int32)

下面来解释一下上面程序的运行过程,在上面的manually_batched_gather_3d运行过程中第一层zip的作用如下

pprint(list(zip(params.numpy().tolist(), indices.numpy().tolist())))
# 打印得到如下list,该list有两个元组组成,都是将两个参数的axis=0轴上的两个二维张量,分别进行了组包
# [([[0, 0, 1, 0, 2],
#    [3, 0, 0, 0, 4],
#    [0, 5, 0, 6, 0]],  # 到这儿为params的axis=0轴上的[0]二维张量
#   [[2, 4],
#    [0, 4],
#    [1, 3]]),  # 到这儿为indices的axis=0轴上的[0]二维张量
#
#  ([[1, 8, 4, 2, 2],
#    [9, 6, 2, 3, 0],
#    [7, 2, 8, 6, 3]],  # 到这儿为params的axis=0轴上的[1]二维张量
#   [[1, 3],
#    [2, 1],
#    [4, 2]])]  # 到这儿为indices的axis=0轴上的[1]二维张量

然后进入第一层for循环的第一次循环,将zip之后的两个元组中的第一个元组,拿过来分别赋给pi

p=tf.Tensor(
[[0 0 1 0 2]
 [3 0 0 0 4]
 [0 5 0 6 0]], shape=(3, 5), dtype=int32)
i=tf.Tensor(
[[2 4]
 [0 4]
 [1 3]], shape=(3, 2), dtype=int32)

在第二层for之前插入,得到第二层的zip结果

print(list(zip(p.numpy().tolist(), i.numpy().tolist())))
# [([0, 0, 1, 0, 2], [2, 4]),
#  ([3, 0, 0, 0, 4], [0, 4]),
#  ([0, 5, 0, 6, 0], [1, 3])]

则开始第二层for的第一次循环,则

# p_2 = tf.Tensor([0 0 1 0 2], shape=(5,), dtype=int32)
# i_2 = tf.Tensor([2 4], shape=(2,), dtype=int32)
# r = tf.Tensor([1 2], shape=(2,), dtype=int32)

这之后第二层for循环再进行2次循环,退回到第一层大循环,第一层大循环再进行一次上述循环即完成了整个循环。

2.4 batch_dims再降为1

你会发现,下面两条指令等价,即batch_dims=1只有一层循环,只zip一次

tf.gather(params, indices, axis=2, batch_dims=1).numpy()
# 等价于
manually_batched_gather(params, indices, axis=2).numpy()
# [[[[1 2]
#    [0 2]
#    [0 0]]
#
#   [[0 4]
#    [3 4]
#    [0 0]]
#
#   [[0 0]
#    [0 0]
#    [5 6]]]
#
#
#  [[[8 2]
#    [4 8]
#    [2 4]]
#
#   [[6 3]
#    [2 6]
#    [0 2]]
#
#   [[2 6]
#    [8 2]
#    [3 8]]]]

2.5 再将axis降为1

还需修改一下indices,因为下文有对indices的约束——必须在 [0, params.shape[axis]] 范围内,此时params.shape(2, 3, 5),则params.shape[1]=3,所以indices只能等于012,如果>=3索引的时候就会溢出。此时还是batch_dims=1只有一层循环,只zip一次,只是改变了索引轴。

indices = tf.constant([
    [[1, 0],
     [2, 1],
     [2, 0]],

    [[2, 0],
     [0, 1],
     [1, 2]]])
tf.gather(params, indices, axis=1, batch_dims=1).numpy()
# 等价于
manually_batched_gather(params, indices, axis=1).numpy()
# array([[[[3, 0, 0, 0, 4],
#          [0, 0, 1, 0, 2]],
# 
#         [[0, 5, 0, 6, 0],
#          [3, 0, 0, 0, 4]],
# 
#         [[0, 5, 0, 6, 0],
#          [0, 0, 1, 0, 2]]],
# 
# 
#        [[[7, 2, 8, 6, 3],
#          [1, 8, 4, 2, 2]],
# 
#         [[1, 8, 4, 2, 2],
#          [9, 6, 2, 3, 0]],
# 
#         [[9, 6, 2, 3, 0],
#          [7, 2, 8, 6, 3]]]], dtype=int32)>>

2.6 batch_dims<0

因为paramsindices一共由3各维度——012,其对应的负维度就是-3-2-1,所以下面两条指令等价

a = tf.gather(params, indices, axis=2, batch_dims=1).numpy()
pprint(a)
# 等价于
a = tf.gather(params, indices, axis=2, batch_dims=-2).numpy()
pprint(a)

2.7 batch_dims总结

故个人认为,batch_dims是由batch和dimensions两个单词缩写而成,因为dimensions为复数所以可以翻译为“批量维度数”(自己翻译没有查到文献),可以指批处理batch_dims个维度,如果是正数可以理解成嵌套几层循环或者进行几次zip,如果是负数需要转化为对应的正维度再进行上述理解;也可以是指组包到哪一个维度上,如果是负数也同样适用于这种解释。

batch_dims极大的扩展了gather的功能,使你可以将paramsindices在对应的某个维度上分别进行gather然后再stack

ps:关于batch_dims的这个解释同样也适用于tf.gather_nd。

3. 补充

如果您需要使用诸如 tf.argsort 或 tf.math.top_k 之类的操作的索引,其中索引的最后一个维度在相应位置索引到输入的最后一个维度,这自然会出现。 在这种情况下,您可以使用 tf.gather(values, indices, batch_dims=-1)。

4. 参数和返回值

参数
params从中收集值的Tensor(张量)。其秩(rank)必须至少为axis + 1。
indices索引张量。 必须是以下类型之一:int32int64。 这些值必须在 [0, params.shape[axis]] 范围内。
validate_indices已弃用,没有任何作用。 索引总是在 CPU 上验证,从不在 GPU 上验证。
注意:在 CPU 上,如果发现越界索引,则会引发错误。 在 GPU 上,如果发现越界索引,则将 0 存储在相应的输出值中。
axis一个Tensor((张量))。 必须是以下类型之一:int32int64。 从参数params中的axis轴收集索引。 必须大于或等于batch_dims。 默认为第一个**非批次维度 **。 支持负索引。
batch_dims一个integer(整数)。 批量维度(batch dimensions)的数量。 必须小于或等于 rank(indices)
name操作的名称(可选)。
返回值
一个Tensor(张量), 与params具有相同的类型。

5. 其他相关论述

下面几篇博客,相对于官网手册都有新的信息增量,可以作为参考

  • 知网《tf.gather()函数》,使用索引推演的方式在维度和操作两个方面进行理解,但是其关于batch_dims的描述不够充分且有些片面;
  • 知乎《tf.gather()函数总结》,举了一个新的例子,但是batch_dims还是只到了1,没有很好的归纳其真正的物理意义;
  • CSDN《tf.gather函数》,跟上一篇的情况差不多。

6. 附件

上文用到的调试程序,可以忽略

import tensorflow as tf
from pprint import pprint

params = tf.constant([[0, 1.0, 2.0],
                      [10.0, 11.0, 12.0],
                      [20.0, 21.0, 22.0],
                      [30.0, 31.0, 32.0]])
a = tf.gather(params, indices=[[2,1], [1,0]], axis=1).numpy()
pprint(a)

params = tf.constant([
    [0, 0, 1, 0, 2],
    [3, 0, 0, 0, 4],
    [0, 5, 0, 6, 0]])
indices = tf.constant([
    [2, 4],
    [0, 4],
    [1, 3]])

a = tf.gather(params, indices, axis=1, batch_dims=1).numpy()
pprint(a)
a = tf.gather(params, indices, axis=1, batch_dims=-1).numpy()
pprint(a)

def manually_batched_gather(params, indices, axis):
  batch_dims=1
  result = []
  for p,i in zip(params, indices):
    r = tf.gather(p, i, axis=axis-batch_dims)
    result.append(r)
  return tf.stack(result)
manually_batched_gather(params, indices, axis=1).numpy()

pprint(list(zip(params.numpy().tolist(), indices.numpy().tolist())))

tf.gather(params, indices, axis=1, batch_dims=0).numpy()
tf.gather(params, indices, axis=1).numpy()
# tf.gather(params, indices, axis=0, batch_dims=0).numpy()

params = tf.constant([[
    [0, 0, 1, 0, 2],
    [3, 0, 0, 0, 4],
    [0, 5, 0, 6, 0]]])
indices = tf.constant([[
    [2, 4],
    [0, 4],
    [1, 3]]])
pprint(list(zip(params.numpy().tolist(), indices.numpy().tolist())))

# [([[0, 0, 1, 0, 2], [3, 0, 0, 0, 4], [0, 5, 0, 6, 0]],
#   [[2, 4], [0, 4], [1, 3]])]

params_1 = [[0, 0, 1, 0, 2],
   [3, 0, 0, 0, 4],
   [0, 5, 0, 6, 0]],
indices_1 = [[2, 4],
   [0, 4],
   [1, 3]]

# a = tf.gather(params_1, indices_1, axis=0).numpy()

params = tf.constant([
    [[0, 0, 1, 0, 2],
     [3, 0, 0, 0, 4],
     [0, 5, 0, 6, 0]],

    [[1, 8, 4, 2, 2],
     [9, 6, 2, 3, 0],
     [7, 2, 8, 6, 3]]])
indices = tf.constant([
    [[2, 4],
     [0, 4],
     [1, 3]],

    [[1, 3],
     [2, 1],
     [4, 2]]])

a = tf.gather(params, indices, axis=2, batch_dims=2).numpy()
pprint(a)
a = tf.gather(params, indices, axis=2, batch_dims=-1).numpy()
pprint(a)

print(list(zip(params.numpy().tolist(), indices.numpy().tolist())))



# [([[0, 0, 1, 0, 2],
#    [3, 0, 0, 0, 4],
#    [0, 5, 0, 6, 0]],
#   [[2, 4],
#    [0, 4],
#    [1, 3]]),
#
#  ([[1, 8, 4, 2, 2],
#    [9, 6, 2, 3, 0],
#    [7, 2, 8, 6, 3]],
#   [[1, 3],
#    [2, 1],
#    [4, 2]])]

def manually_batched_gather_3(params, indices, axis):
  batch_dims=2
  result = []
  for p,i in zip(params, indices):
      result_2 = []
      print(list(zip(p.numpy().tolist(), i.numpy().tolist())))
      for p_2, i_2 in zip(p,i):
          r = tf.gather(p_2, i_2, axis=axis-batch_dims)
          result_2.append(r)
      result.append(result_2)
  return tf.stack(result)
manually_batched_gather_3(params, indices, axis=2).numpy()

# <tf.Tensor: shape=(2, 3, 2), dtype=int32, numpy=
# array([[[1, 2],
#         [3, 4],
#         [5, 6]],
#
#        [[8, 2],
#         [2, 6],
#         [3, 8]]], dtype=int32)>>

# [([0, 0, 1, 0, 2], [2, 4]),
#  ([3, 0, 0, 0, 4], [0, 4]),
#  ([0, 5, 0, 6, 0], [1, 3])]

a = tf.gather(params, indices, axis=2, batch_dims=1).numpy()
pprint(a)
a = tf.gather(params, indices, axis=2, batch_dims=-2).numpy()
pprint(a)
manually_batched_gather(params, indices, axis=2).numpy()
# [[[[1 2]
#    [0 2]
#    [0 0]]
#
#   [[0 4]
#    [3 4]
#    [0 0]]
#
#   [[0 0]
#    [0 0]
#    [5 6]]]
#
#
#  [[[8 2]
#    [4 8]
#    [2 4]]
#
#   [[6 3]
#    [2 6]
#    [0 2]]
#
#   [[2 6]
#    [8 2]
#    [3 8]]]]

indices = tf.constant([
    [[1, 0],
     [2, 1],
     [2, 0]],

    [[2, 0],
     [0, 1],
     [1, 2]]])

a = tf.gather(params, indices, axis=1, batch_dims=1).numpy()
pprint(a)
a = tf.gather(params, indices, axis=1, batch_dims=-2).numpy()
pprint(a)
manually_batched_gather(params, indices, axis=1).numpy()
# array([[[[3, 0, 0, 0, 4],
#          [0, 0, 1, 0, 2]],
#
#         [[0, 5, 0, 6, 0],
#          [3, 0, 0, 0, 4]],
#
#         [[0, 5, 0, 6, 0],
#          [0, 0, 1, 0, 2]]],
#
#
#        [[[7, 2, 8, 6, 3],
#          [1, 8, 4, 2, 2]],
#
#         [[1, 8, 4, 2, 2],
#          [9, 6, 2, 3, 0]],
#
#         [[9, 6, 2, 3, 0],
#          [7, 2, 8, 6, 3]]]], dtype=int32)>>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/383140.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

3.2 http协议

一.HTTP协议1.概述是计算机网络的核心概念,是一种网络协议网络协议种类非常多,其中IP,TCP,UDP...其中还有一个应用非常广泛的协议.HTTPHTTP协议是日常开发中用的最多的协议HTTP处在TCP/IP五层协议栈的应用层HTTP在传输层是基于TCP的,(http/1 HTTP/2是基于TCP,最新版本的HTTP/3是…

交换机电口、光口、网络速率的基本概念总结

电口和光口千兆网 & 万兆网&#xff1a;POE&#xff1a;包转发率&#xff1a;背板带宽/交换容量&#xff1a;)电口和光口 电口&#xff1a; 电口也即RJ45口&#xff0c;插双绞线的端口&#xff08;网线&#xff09;&#xff0c;一般速率为10M或100M&#xff0c;即为百兆工…

[数据结构]:09-二分查找(顺序表指针实现形式)(C语言实现)

目录 前言 已完成内容 二分查找实现 01-开发环境 02-文件布局 03-代码 01-主函数 02-头文件 03-PSeqListFunction.cpp 04-SearchFunction.cpp 结语 前言 此专栏包含408考研数据结构全部内容&#xff0c;除其中使用到C引用外&#xff0c;全为C语言代码。使用C引用主要…

2023年3月北京/上海/广州/深圳DAMA数据管理认证CDGA/CDGP

弘博创新是DAMA中国授权的数据治理人才培养基地&#xff0c;贴合市场需求定制教学体系&#xff0c;采用行业资深名师授课&#xff0c;理论与实践案例相结合&#xff0c;快速全面提升个人/企业数据治理专业知识与实践经验&#xff0c;通过考试还能获得数据专业领域证书。 DAMA认…

【JavaWeb】数据链路层协议——以太网 + 应用层协议——DNS

以太网 以太网不是一个具体的网络&#xff0c;而是一个技术标准&#xff0c;主要应用于数据链路层和物理层。 以太网数据帧结构 以太网的数据帧结构由三部分构成&#xff1a; 帧头 载荷 帧尾 其中的MAC地址是六位&#xff0c;这样就比IPV4所表示的地址大很多&#xff0c;…

Idea git 回滚远程仓库版本

目标 回滚远程仓库到特定版本。 将【添加test03】版本回滚到【行为型模式】版本。 回滚前的效果图 步骤 ①复制需要回滚到的版本的版本号 ②右键项目&#xff0c;选择Git-Repository-Reset Head ③Reset Type选择Hard&#xff1b;To Commit填入步骤①复制的版本号&#xff…

【Flutter·学习实践】运行项目及解决各种报错

文章目录 简介 项目目录介绍 运行报错&#xff1a;Exception: Gradle task assembleDebug failed with exit code 1 简介 我As的版本信息&#xff1a;Android Studio Dolphin | 2021.3.1 Patch 1 上一张搭建好了开发环境我们就开始运行程序检验项目是否存在问题。 项目目…

《分布式技术原理与算法解析》学习笔记Day27

故障隔离 什么是故障隔离&#xff1f; 故障隔离&#xff0c;就是采用一定策略&#xff0c;以实现当某个模块发生故障时&#xff0c;不会影响其他模块继续提供服务&#xff0c;以保证整个系统的可用性&#xff0c;它可以避免分布式系统出现大规模的故障&#xff0c;甚至是瘫痪…

spark history文件占用磁盘过高问题解决

我们目前用的spark版本还是2.x spark的history事件是保存在hdfs上的&#xff0c;通过spark.history.fs.logDirectory指定保存的hdfs目录 使用中发现history日志文件占用磁盘还挺高的 于是写了一个脚本来定期进行清理&#xff0c;只保留一定时间的文件 对于spark离线任务来说…

开学季哪个电容笔好?2023口碑最好电容笔推荐

虽说苹果原装的电容笔非常好用&#xff0c;性能也非常不错&#xff0c;但由于价格昂贵&#xff0c;普通的学生是没办法购买的&#xff0c;再加上重量比较大&#xff0c;使用时间长了&#xff0c;难免会让人感觉到疲劳。如果仅仅是为了学习记笔记&#xff0c;那就没必要再去购买…

ubuntu搭建 自动驾驶单目3d检测smoke 环境

论文&#xff1a;SMOKE&#xff1a;Single-Stage Monocular 3D Object Detection via Keypoint Estimation 论文链接 源码 操作系统&#xff1a;ubuntu18.04 显卡&#xff1a;RTX2080TI 一、搭环境(前面和GitHub上一样&#xff0c;补上我踩的坑) 1.创建虚拟环境 conda create…

PayPal轮询系统解放你的生产力助力起航

现在很多跨境商家手里都有很多PayPal账号&#xff0c;本来多个PayPal账号就是为了防止一个账号出现问题&#xff0c;导致工作没办法继续下去。但是手动切换让很多盯站的商家觉得很麻烦。而且多账号之间本可以相互配合&#xff0c;让彼此的安全系数越来越高&#xff0c;风控越来…

win10 设备管理器中的黄色感叹号(华硕)

目录一、前言二、原因三、方案四、操作一、前言 打开设备管理器&#xff0c;我们可以看到自己设备的信息&#xff0c;但是在重装系统后&#xff0c;你总会在不经意间发现。咦&#xff0c;怎么多了几个感叹号&#xff1f;&#xff1f;&#xff1f; 由于我已经解决该问题&#…

数据库事务详解

概述事务就是数据库为了保证数据的原子性,持久性,隔离性,一致性而提供的一套机制, 在同一事务中, 如果有多条sql执行, 事务可以确保执行的可靠性.数据库事务的四大特性一般来说, 事务是必须满足 4 个条件&#xff08;ACID&#xff09;&#xff1a;原子性&#xff08;Atomicity&…

vscode ssh一直卡在wget的解决方案

vscode ssh一直卡在wget的解决方案找到commit_id 在服务器下点进该目录 .vscode-server\bin 一般日期最新的那一串就是我们需要的commit_id下载vscode-server-linux-x64.tar https://update.code.visualstudio.com/commit:${commit_id}/server-linux-x64/stable 将加粗部分替换…

2023年天津财经大学珠江学院专升本专业课考试题型

天津财经大学珠江学院关于2023年高职升本科专业课考试时间及题型一、专业课考试 &#xff08;一&#xff09;时间安排 2023年天津财经大学珠江学院高职升本科专业课考试定于2023年3月25日14&#xff1a;00-17:00进行&#xff0c;凡报考工商管理、旅游管理、税收学专业的考生&am…

智慧监所三维综合管控平台 构建数字智慧监管体系

建设背景监狱肩负着戒治管理、维持监所安全稳定等职责&#xff0c;目前全国有监管场所5500多个&#xff0c;监狱680多个。近年来&#xff0c;司法部不断加大司法行政改革力度&#xff0c;持续推进“数字法治&#xff0c;智慧司法”信息化体系建设战略部署。“智慧监狱”管理应用…

变更数据捕获(CDC)

从广泛意义上说&#xff0c;全球许多企业每天都需要通过频繁的数据批量处理与加载&#xff0c;来定期将数据从一个数据库迁移到另一个数据库(或数据仓库)。这类定期批量加载的工作&#xff0c;往往既耗费时间&#xff0c;又会消耗原始系统的大量处理能力。因此&#xff0c;管理…

design\project\学习 OAuth 读书笔记(二)

OAuth&#xff08;二&#xff09; 原文链接&#xff1a;OAuth 2.0 tutorial | OAuth flows 本文假设您已经看过 OAuth&#xff08;一&#xff09; 目录OAuth&#xff08;二&#xff09;OpenId ConnectOAuth2&#xff1a;令牌自检&#xff08;Token Introspection&#xff09;…

Qt std :: bad_alloc

文章目录摘要问题出现原因第一种 请求内存多余系统可提供内存第二种 地址空间过于分散&#xff0c;无法满足大块连续内存的请求第三种 堆管理数据结构损坏稍微总结下没想到还能更新参考关键字&#xff1a; std、 bad、 alloc、 OOM、 异常退出摘要 今天又是被BUG统治的一天&a…