mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-23 13:24:28 +08:00
Fixed the type casting benchmarks for fp16
This commit is contained in:
parent
2f2801f096
commit
7c47d3e663
@ -46,8 +46,13 @@ template <typename Device, typename T> class BenchmarkSuite {
|
|||||||
void typeCasting(int num_iters) {
|
void typeCasting(int num_iters) {
|
||||||
eigen_assert(m_ == n_);
|
eigen_assert(m_ == n_);
|
||||||
Eigen::array<TensorIndex, 2> sizes;
|
Eigen::array<TensorIndex, 2> sizes;
|
||||||
sizes[0] = m_;
|
if (sizeof(T) >= sizeof(int)) {
|
||||||
sizes[1] = k_;
|
sizes[0] = m_;
|
||||||
|
sizes[1] = k_;
|
||||||
|
} else {
|
||||||
|
sizes[0] = m_ * sizeof(T) / sizeof(int);
|
||||||
|
sizes[1] = k_ * sizeof(T) / sizeof(int);
|
||||||
|
}
|
||||||
const TensorMap<Tensor<int, 2, 0, TensorIndex>, Eigen::Aligned> A((int*)a_, sizes);
|
const TensorMap<Tensor<int, 2, 0, TensorIndex>, Eigen::Aligned> A((int*)a_, sizes);
|
||||||
TensorMap<Tensor<T, 2, 0, TensorIndex>, Eigen::Aligned> B(b_, sizes);
|
TensorMap<Tensor<T, 2, 0, TensorIndex>, Eigen::Aligned> B(b_, sizes);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user