美文网首页
keras tensor基本操作

keras tensor基本操作

作者: carry_xz | 来源:发表于2019-06-23 00:15 被阅读0次

tensor操作

reshape

keras.backend.reshape(x,shape)
Arguments
  • x:Tensor or variable
  • shape:Target shape tuple

permute_dimensions

keras.backend.permute_dimensions(x,pattern)
Arguments
  • pattern: A tuple of dimension indices eg.(0,2,1)

resize_images

keras.backend.resize_images(x, height_factor, width_factor, data_format, interpolation='nearest')

Resizes the images contained in a 4D tensor.

Arguments
  • x: Tensor or variable to resize.
  • height_factor: Positive integer.
  • width_factor: Positive integer.
  • data_format: string, "channels_last" or "channels_first".
  • interpolation: A string, one of nearest or bilinear.

resize_volumes

keras.backend.resize_volumes(x, depth_factor, height_factor, width_factor, data_format)

Resizes the volume contained in a 5D tensor.

Arguments
  • x: Tensor or variable to resize.
  • depth_factor: Positive integer.
  • height_factor: Positive integer.
  • width_factor: Positive integer.
  • data_format: string, "channels_last" or "channels_first".

arange

keras.backend.arange(start, stop=None, step=1, dtype='int32')

Creates a 1D tensor containing a sequence of integers.

Arguments
  • start: Start value.
  • stop: Stop value.
  • step: Difference between two successive values.
  • dtype: Integer dtype to use.

tile

keras.backend.tile(x, n)

Creates a tensor by tiling x by n.return a tiled tensor .网格化tensor,像瓷砖一样铺展开来,类似于repeat复制

Arguments
  • x: A tensor or variable
  • n: A list of integer. The length must be the
  • same as the number of dimensions in x.

batch_flatten

keras.backend.batch_flatten(x)

Turn a nD tensor into a 2D tensor with same 0th dimension.
In other words, it flattens each data samples of a batch.按batch展开tensor。

expand_dims

keras.backend.expand_dims(x, axis=-1)

在指定的轴上进行维度拓展

Arguments
  • x: A tensor or variable.
  • axis: Position where to add a new axis.

squeeze

keras.backend.squeeze(x,axis)

Removes a 1-dimension from the tensor at index "axis".
降低指定轴上的维度

cast

keras.backend.cast(x, dtype)

Casts a tensor to a different dtype and returns it.
You can cast a Keras variable but it still returns a Keras tensor.
数据类型转化

相关文章

网友评论

      本文标题:keras tensor基本操作

      本文链接:https://www.haomeiwen.com/subject/oksofctx.html