Creates a constant tensor. Arguments: value: A constant value (or list) dtype: The type of the elements of the resulting tensor. shape: Optional dimensions of resulting tensor. name: Optional name for the tensor. Returns: A Constant Tensor.
(value, dtype=None, shape=None, name=None)
| 912 | |
| 913 | @keras_export('keras.backend.constant') |
| 914 | def constant(value, dtype=None, shape=None, name=None): |
| 915 | """Creates a constant tensor. |
| 916 | |
| 917 | Arguments: |
| 918 | value: A constant value (or list) |
| 919 | dtype: The type of the elements of the resulting tensor. |
| 920 | shape: Optional dimensions of resulting tensor. |
| 921 | name: Optional name for the tensor. |
| 922 | |
| 923 | Returns: |
| 924 | A Constant Tensor. |
| 925 | """ |
| 926 | if dtype is None: |
| 927 | dtype = floatx() |
| 928 | |
| 929 | return constant_op.constant(value, dtype=dtype, shape=shape, name=name) |
| 930 | |
| 931 | |
| 932 | def is_keras_tensor(x): |