• Extracts a strided slice of a tensor.

    Roughly speaking, this op extracts a slice of size (end-begin)/stride from the given input tensor (x). Starting at the location specified by begin the slice continues by adding stride to the index until all dimensions are not less than end. Note that a stride can be negative, which causes a reverse slice.

    const t = tf.tensor3d([1, 1, 1 ,2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6],
    [3, 2, 3]);
    t.stridedSlice([1, 0, 0], [2, 1, 3], [1, 1, 1]).print() // [[[3, 3, 3]]]
    t.stridedSlice([1, 0, 0], [2, 2, 3], [1, 1, 1]).print() // [[[3, 3, 3],
    // [4, 4, 4]]]
    t.stridedSlice([1, -1, 0], [2, -3, 3], [1, -1, 1]).print() // [[[4, 4, 4],
    // [3, 3, 3]]]

    Parameters

    • x: Tensor<Rank> | TensorLike

      The tensor to stride slice.

    • begin: number[]

      The coordinates to start the slice from.

    • end: number[]
    • Optional strides: number[]
    • Optional beginMask: number
    • Optional endMask: number
    • Optional ellipsisMask: number
    • Optional newAxisMask: number
    • Optional shrinkAxisMask: number

    Returns Tensor

    Doc

Generated using TypeDoc