Skip to content

Commit

Permalink
move doc to right place
Browse files Browse the repository at this point in the history
  • Loading branch information
Liangliang-Ma committed May 6, 2024
1 parent 706934f commit 3073f9a
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions csrc/xpu/packbits/packing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ sycl::queue get_current_queue(at::Device device)
return queue;
}

/*
pack float tensor into uint8 tensor. Every eight float elements get packed into one uint8
if float x >= 0, will be packed as a '1' bit, or will be packed as '0'
Arguments:
tensor: A bool tensor that get packed.
input_size: numel of input tensor
rank: device id in order to get corresponding stream
*/
at::Tensor packbits(at::Tensor tensor, int input_size, int rank)
{
/*
pack float tensor into uint8 tensor. Every eight float elements get packed into one uint8
if float x >= 0, will be packed as a '1' bit, or will be packed as '0'
Arguments:
tensor: A bool tensor that get packed.
input_size: numel of input tensor
rank: device id in order to get corresponding stream
*/
at::Device device = "xpu:" + std::to_string(rank);
sycl::queue q = get_current_queue(device);

Expand All @@ -66,16 +66,16 @@ at::Tensor packbits(at::Tensor tensor, int input_size, int rank)
return packed;
}

/*
unpack uint8 tensor into float tensor. Every uint8 element get unpacked into eight float
a '1' bit will be converted to a float(1), a '0' bit will be converted to a float(-1).
Arguments:
tensor: A uint8 tensor that get unpacked.
input_size: numel of input tensor
rank: device id in order to get corresponding stream
*/
at::Tensor unpackbits(at::Tensor tensor, int input_size, int rank)
{
/*
unpack uint8 tensor into float tensor. Every uint8 element get unpacked into eight float
a '1' bit will be converted to a float(1), a '0' bit will be converted to a float(-1).
Arguments:
tensor: A uint8 tensor that get unpacked.
input_size: numel of input tensor
rank: device id in order to get corresponding stream
*/
at::Device device = "xpu:" + std::to_string(rank);
sycl::queue q = get_current_queue(device);

Expand Down

0 comments on commit 3073f9a

Please sign in to comment.