tf.dtypes.DType
Stay organized with collections
Save and categorize content based on your preferences.
Represents the type of the elements in a Tensor
.
tf.dtypes.DType()
DType
s are used to specify the output data type for operations which
require it, or to inspect the data type of existing Tensor
s.
Examples:
tf.constant(1, dtype=tf.int64)
<tf.Tensor: shape=(), dtype=int64, numpy=1>
tf.constant(1.0).dtype
tf.float32
See tf.dtypes
for a complete list of DType
s defined.
Attributes |
as_datatype_enum
|
Returns a types_pb2.DataType enum value based on this data type.
|
as_numpy_dtype
|
Returns a Python type object based on this DType .
|
base_dtype
|
Returns a non-reference DType based on this DType .
|
is_bool
|
Returns whether this is a boolean data type.
|
is_complex
|
Returns whether this is a complex floating point type.
|
is_floating
|
Returns whether this is a (non-quantized, real) floating point type.
|
is_integer
|
Returns whether this is a (non-quantized) integer type.
|
is_numpy_compatible
|
Returns whether this data type has a compatible NumPy data type.
|
is_quantized
|
Returns whether this is a quantized data type.
|
is_unsigned
|
Returns whether this type is unsigned.
Non-numeric, unordered, and quantized types are not considered unsigned, and
this function returns False .
|
limits
|
Return intensity limits, i.e.
(min, max) tuple, of the dtype.
Args:
clip_negative : bool, optional If True, clip the negative range (i.e.
return 0 for min intensity) even if the image dtype allows negative
values. Returns
min, max : tuple Lower and upper intensity limits.
|
max
|
Returns the maximum representable value in this data type.
|
min
|
Returns the minimum representable value in this data type.
|
name
|
|
real_dtype
|
Returns the DType corresponding to this DType 's real part.
|
size
|
|
Methods
is_compatible_with
View source
is_compatible_with(
other
)
Returns True if the other
DType will be converted to this DType.
The conversion rules are as follows:
DType(T) .is_compatible_with(DType(T)) == True
Args |
other
|
A DType (or object that may be converted to a DType ).
|
Returns |
True if a Tensor of the other DType will be implicitly converted to
this DType .
|
__eq__
View source
__eq__(
other
)
Returns True iff this DType refers to the same type as other
.
__ne__
View source
__ne__(
other
)
Returns True iff self != other.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2022-11-04 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2022-11-04 UTC."],[],[]]