fill_diagonal_tensor_¶
- paddle.Tensor. fill_diagonal_tensor_ ( x, y, offset=0, dim1=0, dim2=1, name=None )
- 
         Note This API is ONLY available in Dygraph mode. This function fill the source Tensor y into the x Tensor’s diagonal inplace. - Parameters
- 
           - x (Tensor) – - xis the original Tensor
- y (Tensor) – - yis the Tensor to filled in x
- dim1 (int,optional) – first dimension with respect to which to fill diagonal. Default: 0. 
- dim2 (int,optional) – second dimension with respect to which to fill diagonal. Default: 1. 
- offset (int,optional) – the offset to the main diagonal. Default: 0 (main diagonal). 
- name (str, optional) – Name for the operation (optional, default is None). For more information, please refer to Name. 
 
- Returns
- 
           Tensor with diagonal filled with y. 
- Return type
- 
           Tensor 
 Examples import paddle x = paddle.ones((4, 3)) * 2 y = paddle.ones((3,)) x.fill_diagonal_tensor_(y) print(x.tolist()) #[[1.0, 2.0, 2.0], [2.0, 1.0, 2.0], [2.0, 2.0, 1.0], [2.0, 2.0, 2.0]] 
