ocnn.utils
Wraps |
|
Wraps |
|
Extends |
|
Reduces all values from the |
|
Initialize convolution weights with the same method as |
|
Resizes the number of elements of |
|
Returns a string representation of |
|
Builds an example octree on CPU from at most 3 points. |
- trunc_div(input, other)[source]
Wraps
torch.div()for compatibility. It rounds the results of the division towards zero and is equivalent to C-style integer division.
- meshgrid(*tensors, indexing: str | None = None)[source]
Wraps
torch.meshgrid()for compatibility.
- cumsum(data: Tensor, dim: int, exclusive: bool = False)[source]
Extends
torch.cumsum()with the input argumentexclusive.- Parameters:
data (torch.Tensor) – The input data.
dim (int) – The dimension to do the operation over.
exclusive (bool) – If false, the behavior is the same as
torch.cumsum(); if true, returns the cumulative sum exclusively. Note that if ture, the shape of output tensor is larger by 1 thandatain the dimension where the computation occurs.
- scatter_add(src: Tensor, index: Tensor, dim: int = -1, out: Tensor | None = None, dim_size: int | None = None) Tensor[source]
Reduces all values from the
srctensor intooutat the indices specified in theindextensor along a given axisdim. This is just a wrapper oftorch.scatter()in a boardcasting fashion.- Parameters:
src (torch.Tensor) – The source tensor.
index (torch.Tensor) – The indices of elements to scatter.
dim (int) – The axis along which to index, (default:
-1).out (torch.Tensor or None) – The destination tensor.
dim_size (int or None) – If
outis not given, automatically create output with sizedim_sizeat dimensiondim. Ifdim_sizeis not given, a minimal sized output tensor according toindex.max() + 1is returned.
- xavier_uniform_(weights: Tensor)[source]
Initialize convolution weights with the same method as
torch.nn.init.xavier_uniform_.torch.nn.init.xavier_uniform_initialize a tensor with shape(out_c, in_c, kdim), which can not be used inocnn.nn.OctreeConvsince the the shape ofOctreeConv.weightsis(kdim, in_c, out_c).