(list_shape)
| 416 | return attr_shape |
| 417 | |
| 418 | def _get_shape_tensor(list_shape): |
| 419 | shape_tensor_list = [] |
| 420 | for idx, dim in enumerate(list_shape): |
| 421 | if isinstance(dim, Variable): |
| 422 | dim.stop_gradient = True |
| 423 | check_dtype( |
| 424 | dim.dtype, |
| 425 | 'shape[' + str(idx) + ']', |
| 426 | ['int32', 'int64'], |
| 427 | op_type, |
| 428 | f'(When type of shape in {op_type} is list or tuple.)', |
| 429 | ) |
| 430 | if convert_dtype(dim.dtype) == 'int64': |
| 431 | dim = paddle.cast(x=dim, dtype='int32') |
| 432 | shape_tensor_list.append(dim) |
| 433 | else: |
| 434 | temp_out = fill_constant([], 'int32', dim, force_cpu=True) |
| 435 | shape_tensor_list.append(temp_out) |
| 436 | return shape_tensor_list |
| 437 | |
| 438 | if isinstance(shape, Variable): |
| 439 | shape.stop_gradient = True |
no test coverage detected