OnesLike


tensorflow C++ API

tensorflow::ops::OnesLike

Returns a tensor of ones with the same shape and type as x.


Summary

Creates a tensor with all elements set to 1.

Given a single tensor (tensor), this operation returns a tensor of the same type and shape astensorwith all elements set to 1. Optionally, you can specify a new type (dtype) for the returned tensor.

For example(python):

# 'tensor' is [[1, 2, 3], [4, 5, 6]]


tf.ones_like(tensor)==>[[1,1,1],[1,1,1]]

Arguments:

  • scope: A Scope object
  • x: a tensor of type T.

Returns:

  • Output : a tensor of the same shape and type as x but filled with ones.

OnesLike block

Source link :https://github.com/EXPNUNI/enuSpaceTensorflow/blob/master/enuSpaceTensorflow/tf_array_ops.cpp

Argument:

  • Scope scope : A Scope object (A scope is generated automatically each page. A scope is not connected.)
  • Input x: a tensor of type T.

Output:

  • Output y: Output object of OnesLike class object.

Result:

  • std::vector(Tensor) result_y: A Tensor . The same shape and type as x but filled with ones.

Using Method

results matching ""

    No results matching ""