pub fn gather<'graph, A, B, F: Float>(param: A, indices: B, axis: isize) -> Tensor<'graph, F>
where
    A: AsRef<Tensor<'graph, F>> + Copy,
    B: AsRef<Tensor<'graph, F>> + Copy,
{
    let param = param.as_ref();
    let g = param.graph();
    let op = array_ops::Gather {
        axis,
        should_normalize_negative_indices: false,
    };
    Tensor::builder(g)
        .append_input(indices.as_ref(), false)
        .append_input(param, false)
        .build(op)
}
/// Gathers subviews from the input tensor.
///
/// Same spec as <https://www.tensorflow.org/api_docs/python/tf/gather>.
/// For example, this can be used for embedding vectors lookup etc.
///
/// # Returns
/// Tensor with shape `param.shape[..axis] + indices.shape + param.shape[axis+1..]`
///
/// ```
/// use ndarray::array;
/// use autograd as ag;
/// use ag::tensor_ops::*;
///
/// ag::run(|g| {
///    let param = zeros(&[5, 4, 8, 2], g);
///    let indices = convert_to_tensor(array![[5., 4., 3.], [2., 1., 0.]], g);  // shape: (2, 3)
///    let y = gather(param, indices, 2);
///
///    assert_eq!(y.eval(g).unwrap().shape(), &[5, 4, 2, 3, 2])
/// });
/// ```
Gathers subviews from the input tensor.
Same spec as .
For example, this can be used for embedding vectors lookup etc.
Gathers subviews from the input tensor . Same spec as . For example this can be used for embedding vectors lookup etc .
pub fn gather<'graph, A, B, F: Float>(param: A, indices: B, axis: isize) -> Tensor<'graph, F>
where
    A: AsRef<Tensor<'graph, F>> + Copy,
    B: AsRef<Tensor<'graph, F>> + Copy,
{
    let param = param.as_ref();
    let g = param.graph();
    let op = array_ops::Gather {
        axis,
        should_normalize_negative_indices: false,
    };
    Tensor::builder(g)
        .append_input(indices.as_ref(), false)
        .append_input(param, false)
        .build(op)
}
pub fn gather < ' graph , A , B , F : Float > ( param : A , indices : B , axis : isize ) -> Tensor < ' graph , F > where A : AsRef < Tensor < ' graph , F > > + Copy , B : AsRef < Tensor < ' graph , F > > + Copy , { let param = param . as_ref ( ) ; let g = param . graph ( ) ; let op = array_ops :: Gather { axis , should_normalize_negative_indices : false , } ; Tensor :: builder ( g ) . append_input ( indices . as_ref ( ) , false ) . append_input ( param , false ) . build ( op ) }
Gathers subviews from the input tensor.
Gathers subviews from the input tensor .
param
A
indices
B
axis
isize
None
param
A
indices
B
axis
isize