set_zero

Tensor.set_zero()

Zeros all elements of the tensor in-place.

For a contiguous tensor, this is equivalent to set the entire tensor memory region the entire tensor to 0. For a CompND tensor, this recursively zeros to all sub-tensors. For an ROI tensor (created via SelectROI/SelectBatch), only the ROI region is zeroed.

Raises:

RuntimeError -- If the operation fails.