Fix typo (#2514)
This commit is contained in:
@@ -86,7 +86,7 @@ and destroying the `Tensor` doesn't deallocate the array of elements.
|
|||||||
|
|
||||||
This has implications for developers of generic `Tensor` algorithms.
|
This has implications for developers of generic `Tensor` algorithms.
|
||||||
For example, input `Tensor` parameters of a function
|
For example, input `Tensor` parameters of a function
|
||||||
should be passed by referece or const reference,
|
should be passed by reference or const reference,
|
||||||
because passing a `Tensor` by value
|
because passing a `Tensor` by value
|
||||||
may or may not make a deep copy of the `Tensor`'s elements.
|
may or may not make a deep copy of the `Tensor`'s elements.
|
||||||
|
|
||||||
|
|||||||
@@ -72,8 +72,8 @@ namespace layout {
|
|||||||
|
|
||||||
// test capacity
|
// test capacity
|
||||||
auto capacity = tensor_nhwc.capacity(cutlass::Tensor4DCoord(n_size, h_size, w_size, c_size));
|
auto capacity = tensor_nhwc.capacity(cutlass::Tensor4DCoord(n_size, h_size, w_size, c_size));
|
||||||
decltype(capacity) referece_capacity = ldh * n_size;
|
decltype(capacity) reference_capacity = ldh * n_size;
|
||||||
EXPECT_EQ(capacity, referece_capacity);
|
EXPECT_EQ(capacity, reference_capacity);
|
||||||
|
|
||||||
// test packed
|
// test packed
|
||||||
auto packed_tensor_layout = tensor_nhwc.packed(cutlass::Tensor4DCoord(n_size, h_size, w_size, c_size));
|
auto packed_tensor_layout = tensor_nhwc.packed(cutlass::Tensor4DCoord(n_size, h_size, w_size, c_size));
|
||||||
@@ -115,8 +115,8 @@ namespace layout {
|
|||||||
|
|
||||||
// test capacity
|
// test capacity
|
||||||
auto capacity = tensor_nchw.capacity(cutlass::Tensor4DCoord(n_size, h_size, w_size, c_size));
|
auto capacity = tensor_nchw.capacity(cutlass::Tensor4DCoord(n_size, h_size, w_size, c_size));
|
||||||
decltype(capacity) referece_capacity = ldc * n_size;
|
decltype(capacity) reference_capacity = ldc * n_size;
|
||||||
EXPECT_EQ(capacity, referece_capacity);
|
EXPECT_EQ(capacity, reference_capacity);
|
||||||
|
|
||||||
// test packed
|
// test packed
|
||||||
auto packed_tensor_layout = tensor_nchw.packed(cutlass::Tensor4DCoord(n_size, h_size, w_size, c_size));
|
auto packed_tensor_layout = tensor_nchw.packed(cutlass::Tensor4DCoord(n_size, h_size, w_size, c_size));
|
||||||
|
|||||||
@@ -34,19 +34,19 @@
|
|||||||
|
|
||||||
#include "../common/cutlass_unit_test.h"
|
#include "../common/cutlass_unit_test.h"
|
||||||
#include "cutlass/layout/tensor.h"
|
#include "cutlass/layout/tensor.h"
|
||||||
#include "cutlass/util/device_memory.h"
|
#include "cutlass/util/device_memory.h"
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
namespace test {
|
namespace test {
|
||||||
namespace layout {
|
namespace layout {
|
||||||
|
|
||||||
void test_nhwc_layout(int n_size, int h_size, int w_size, int c_size) {
|
void test_nhwc_layout(int n_size, int h_size, int w_size, int c_size) {
|
||||||
int ldc = c_size + 1;
|
int ldc = c_size + 1;
|
||||||
int ldw = ldc * (w_size + 2);
|
int ldw = ldc * (w_size + 2);
|
||||||
int ldh = ldw * (h_size + 3);
|
int ldh = ldw * (h_size + 3);
|
||||||
|
|
||||||
typedef cutlass::layout::TensorNHWC Tensor;
|
typedef cutlass::layout::TensorNHWC Tensor;
|
||||||
|
|
||||||
Tensor::Stride tensor_stride({ ldc, ldw, ldh });
|
Tensor::Stride tensor_stride({ ldc, ldw, ldh });
|
||||||
Tensor tensor_nhw_packed_c(tensor_stride);
|
Tensor tensor_nhw_packed_c(tensor_stride);
|
||||||
|
|
||||||
@@ -74,8 +74,8 @@ namespace layout {
|
|||||||
// test capacity
|
// test capacity
|
||||||
auto capacity = tensor_nhw_packed_c.capacity(
|
auto capacity = tensor_nhw_packed_c.capacity(
|
||||||
cutlass::Tensor4DCoord(n_size, h_size, w_size, c_size));
|
cutlass::Tensor4DCoord(n_size, h_size, w_size, c_size));
|
||||||
decltype(capacity) referece_capacity = ldh * n_size;
|
decltype(capacity) reference_capacity = ldh * n_size;
|
||||||
EXPECT_EQ(capacity, referece_capacity);
|
EXPECT_EQ(capacity, reference_capacity);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ namespace layout {
|
|||||||
int ldh = ldw * h_size;
|
int ldh = ldw * h_size;
|
||||||
|
|
||||||
typedef cutlass::layout::TensorNHWC Tensor;
|
typedef cutlass::layout::TensorNHWC Tensor;
|
||||||
|
|
||||||
Tensor::Stride tensor_stride({ ldc, ldw, ldh });
|
Tensor::Stride tensor_stride({ ldc, ldw, ldh });
|
||||||
Tensor tensor_nhw_packed_c(tensor_stride);
|
Tensor tensor_nhw_packed_c(tensor_stride);
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ namespace layout {
|
|||||||
dim3 grid(1,1);
|
dim3 grid(1,1);
|
||||||
dim3 block(c_size, 1, 1);
|
dim3 block(c_size, 1, 1);
|
||||||
|
|
||||||
test::layout::test_nhwc_inverse<<< grid, block >>>(output.get(),
|
test::layout::test_nhwc_inverse<<< grid, block >>>(output.get(),
|
||||||
n_size, h_size, w_size, c_size);
|
n_size, h_size, w_size, c_size);
|
||||||
|
|
||||||
cudaError_t result = cudaDeviceSynchronize();
|
cudaError_t result = cudaDeviceSynchronize();
|
||||||
|
|||||||
Reference in New Issue
Block a user