Commit 4defb148 authored by Po-Yen, Chen's avatar Po-Yen, Chen
Browse files

Usw switch() to group similar codes

parent 3cbf5d96
...@@ -493,8 +493,9 @@ host_permute(const Tensor<Src>& src, const Axes& axes, Functor functor, Tensor<D ...@@ -493,8 +493,9 @@ host_permute(const Tensor<Src>& src, const Axes& axes, Functor functor, Tensor<D
return false; return false;
} }
if(size(shape) == 3) switch(size(shape))
{ {
case 3: {
do do
{ {
Dest output = 0; Dest output = 0;
...@@ -502,8 +503,8 @@ host_permute(const Tensor<Src>& src, const Axes& axes, Functor functor, Tensor<D ...@@ -502,8 +503,8 @@ host_permute(const Tensor<Src>& src, const Axes& axes, Functor functor, Tensor<D
dest(indices[axes[0]], indices[axes[1]], indices[axes[2]]) = output; dest(indices[axes[0]], indices[axes[1]], indices[axes[2]]) = output;
} while(advance_indices(shape, indices)); } while(advance_indices(shape, indices));
} }
else if(size(shape) == 4) break;
{ case 4: {
do do
{ {
Dest output = 0; Dest output = 0;
...@@ -511,9 +512,8 @@ host_permute(const Tensor<Src>& src, const Axes& axes, Functor functor, Tensor<D ...@@ -511,9 +512,8 @@ host_permute(const Tensor<Src>& src, const Axes& axes, Functor functor, Tensor<D
dest(indices[axes[0]], indices[axes[1]], indices[axes[2]], indices[axes[3]]) = output; dest(indices[axes[0]], indices[axes[1]], indices[axes[2]], indices[axes[3]]) = output;
} while(advance_indices(shape, indices)); } while(advance_indices(shape, indices));
} }
else break;
{ default: return false;
return false;
} }
return true; return true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment