-
#include "tensorstore/array.h"
-
template <typename TargetElement,
typename E,
DimensionIndex R,
ArrayOriginKind O,
ContainerKind C>
Result<SharedArray<TargetElement, R, O>> tensorstore::MakeCopy(
const Array<E, R, O, C>& source,
IterationConstraints constraints = {c_order,
include_repeated_elements},
dtype_t<TargetElement> target_dtype = dtype_v<TargetElement>); -
template <int&... ExplicitArgumentBarrier,
typename E,
DimensionIndex R,
ArrayOriginKind O,
ContainerKind C>
Result<SharedArray<void, R, O>>
tensorstore::MakeCopy(const Array<E, R, O, C>& source,
IterationConstraints constraints,
DataType target_dtype); Returns a copy of the contents of an array, with the data type converted.
- Template Parameters:¶
- typename TargetElement¶
Optional. Specifies the target data type at compile time.
- Parameters:¶
- const Array<E, R, O, C> &source¶
The source array to copy.
- IterationConstraints constraints = {c_order, include_repeated_elements}¶
- IterationConstraints constraints
Constrains the layout of the newly allocated array. See the documentation of the
MakeCopy
overload above.- dtype_t<TargetElement> target_dtype = dtype_v<TargetElement>¶
- DataType target_dtype
Specifies the target data type at run time. Required if
TargetElement
isvoid
and when invoking the overload without theTargetElement
template parameter.
- Returns:¶
The newly allocated array containing the converted copy.
- Error absl::StatusCode::kInvalidArgument:¶
if the conversion is not supported or fails.