作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
tf.data.Dataset
的构造函数接受一个参数 variant_tensor
,这只是 documented as :
A DT_VARIANT tensor that represents the dataset.
in the DatasetV2, we expect subclasses to create a variant_tensor and pass it in to the super() call.
最佳答案
变体张量可以是任何数据类型的张量。
变体张量的一些示例如下所示:
# Integer element
a = 1
# Float element
b = 2.0
# Tuple element with 2 components
c = (1, 2)
# Dict element with 3 components
d = {"a": (2, 2), "b": 3}
# Element containing a dataset
e = tf.data.Dataset.from_element(10)
Variant Tensor
的说明或
DT_Variant
如下所示。
// This is an implementation of a type-erased container that can store an
// object of any type. The implementation is very similar to std::any, but has
// restrictions on the types of objects that can be stored, and eschews some of
// the fancier constructors available for std::any. An object of
// tensorflow::Variant is intended to be used as the value that will be stored
// in a tensorflow::Tensor object when its type is DT_VARIANT.
//
// tensorflow::Variant can store an object of a class that satisfies the
// following constraints:
//
// * The class is CopyConstructible.
// * The class has a default constructor.
// * It's either a protocol buffer, a tensorflow::Tensor, or defines the
// following functions:
//
// string TypeName() const;
// void Encode(VariantTensorData* data) const;
// bool Decode(VariantTensorData data);
关于python - 什么是 DT_VARIANT 张量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58899763/
tf.data.Dataset的构造函数接受一个参数 variant_tensor ,这只是 documented as : A DT_VARIANT tensor that represents t
我是一名优秀的程序员,十分优秀!