从宿主指针进行构造时,是否自动推断类型
Does array fire constructor automatically deduce type when constructing from host pointer?
我从array fire的文档中读到可以从宿主指针构造一个array fire数组。就像
double * host_data;
//do stuff with host_data
af::array array(nrows, ncols, host_data); //suppose is a nrows by ncols array
然而,我现在还不清楚数组火灾是否会自动决定数组的类型为"double"(f64)而不是默认的float(f32)。
非常感谢您的帮助
是的,宿主指针用于推断数组的类型。这就是为什么这个特定的构造函数没有显式传递类型的参数。
相关文章:
- 是否可以初始化不可复制类型的成员变量(或基类)
- 是否可以从int转换为enum类类型
- 检查 std::shared_ptr<> 的当前底层类型是否为 T
- 函数作为模板参数,是否对返回类型强制约束
- JS相等运算符(如===)是否可以使用embind类型
- visual是否可以在c++中创建一个接收无限数量相同类型(或至少相当数量)参数的函数
- 检查函数返回类型是否与STL容器类型值相同
- 在类型和包装器之间reinterpret_cast是否安全<Type>?
- 检查某些类型是否是模板类 std::optional 的实例化
- 是否有内置方法可以强制转换为不同的基础类型,但保留常量限定符?
- C++类型特征,以查看是否可以<uint32_t>对类型"K"的任何变量调用"static_cast(k)"
- boost 是否有按特殊类型值编码状态"compact optional"?
- 初始值设定项列表是否只接受使用相同类型的值初始化变量?
- 是否有任何建议来统一函数类型限定符并简化可恶的函数类型?
- 表达式 SFINAE:如何根据类型是否包含具有一个或多个参数的函数来选择模板版本
- 检查一个类型是否直接派生自"enable if"上下文中的另一个类型(是其子类型)
- 在运行时检查继承是否只有一种类型和 void*
- 给定一个C++嵌套的私有结构类型,是否有从文件范围静态函数访问它的策略
- 将类型声明为类型模板参数的模板参数的一部分是否合法?
- 当返回类型声明为 ListNode 时,我们是否可以返回 false<T>*