asc2.zeros_like

asc2.zeros_like(input: ~asc.language.tile.local_tensor.LocalTensor, location: ~asc._C.libpyasc.ir.TensorLocation = <TensorLocation.UB: 26>) LocalTensor

Create a tensor filled with zeros, with the same shape and dtype as the input tensor.

The supported data types are: int8, int16, int32, int64, float16, bfloat16, float32.

Parameters:
  • input – The input tensor to match shape and dtype.

  • location – The memory location for the tensor. Default is TensorLocation.UB.

Returns:

A new tensor filled with zeros

Return type:

LocalTensor

Raises:

TypeError – If input is not a LocalTensor

Examples

Create a zero-filled tensor matching another tensor’s shape and dtype:

src = asc2.copy_in(x_gm, [0], [128])
result = asc2.zeros_like(src)