fullLike<T extends SizedNativeType> function

VARP fullLike<T extends SizedNativeType>(
  1. VARP a,
  2. num fillValue, {
  3. String order = "K",
  4. List<int>? shape,
})

full_like(a, fill_value, dtype=None, order='K', subok=True, shape=None) Return a full var with the same shape and type as a given var.

Parameters

a : var_like The shape and data-type of a define these same attributes of the returned var. fill_value : scalar Fill value. dtype : data-type, optional Overrides the data type of the result. order : {'C', 'F', 'A', or 'K'}, optional Compatible with numpy. subok : bool, optional. Compatible with numpy. shape : int or sequence of ints, optional. Overrides the shape of the result.

Returns

out : var Var of fill_value with the same shape and type as a.

Examples

x = np.arange(6, dtype=np.int32) np.full_like(x, 1) var(1, 1, 1, 1, 1, 1) np.full_like(x, 0.1) var(0, 0, 0, 0, 0, 0) np.full_like(x, 0.1, dtype=np.float32) var(0.1, 0.1, 0.1, 0.1, 0.1, 0.1) y = np.arange(6, dtype=np.float32) np.full_like(y, 0.1) var(0.1, 0.1, 0.1, 0.1, 0.1, 0.1)

Implementation

VARP fullLike<T extends ffi.SizedNativeType>(
  VARP a,
  num fillValue, {
  String order = "K",
  List<int>? shape,
}) {
  final (dstDtype, dstShape) = _arrayLikeType(a, order: order, shape: shape);
  return full<T>(dstShape, F.scalar<T>(fillValue), order: order);
}