(shape, dtype)
| 655 | |
| 656 | |
| 657 | def _ones(shape, dtype): |
| 658 | as_dtype = dtypes.as_dtype(dtype) |
| 659 | if as_dtype == dtypes.string: |
| 660 | return None |
| 661 | |
| 662 | if not context.context().executing_eagerly(): |
| 663 | return array_ops.ones(shape, dtype) |
| 664 | |
| 665 | if as_dtype.is_bool: |
| 666 | value = True |
| 667 | else: |
| 668 | value = 1 |
| 669 | |
| 670 | if shape == (): # pylint: disable=g-explicit-bool-comparison |
| 671 | return constant_op.constant(value, dtype=dtype) |
| 672 | return _fast_fill(value, shape, dtype) |
| 673 | |
| 674 | |
| 675 | _default_vspace = imperative_grad.VSpace( |
nothing calls this directly
no test coverage detected