Sha256: 46d1c6422eb6619d89397cb080ed14dd14355d18408970373d1d97266043158b

Contents?: true

Size: 899 Bytes

Versions: 3

Compression:

Stored size: 899 Bytes

Contents

TensorStream::OpMaker.define_operation :strided_slice do |op|
  op.what_it_does "Extracts a strided slice of a tensor "
  op.what_it_does "this op extracts a slice of size `(end-begin)/stride`
  from the given `input_` tensor. 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."

  op.parameter :input, "A tensor"
  op.parameter :_begin, "start index"
  op.parameter :_end, "end index"
  op.parameter :strides, "end index", :nil
  op.option :name, "Optional name", :nil

  op.define_gradient do |grad, node, params|
    input, b_index, e_index, strides = params
    x = ts.shape(input, out_type: node.inputs[0].data_type)

    _op(:strided_slice_grad, x, b_index, e_index, strides, grad)
  end

  op.define_shape do |tensor|
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tensor_stream-1.0.9 lib/tensor_stream/ops/strided_slice.rb
tensor_stream-1.0.8 lib/tensor_stream/ops/strided_slice.rb
tensor_stream-1.0.7 lib/tensor_stream/ops/strided_slice.rb