round {GPUmatrix} | R Documentation |
rounding of numers
Description
It mimics the base function 'round'
to operate on gpu.matrix-class objects. This function rounds the values in its first argument to the specified number of decimal places (default 0).
Usage
## S4 method for signature 'gpu.matrix.tensorflow,ANY'
round(x)
## S4 method for signature 'gpu.matrix.torch,missing'
round(x,digits)
## S4 method for signature 'gpu.matrix.torch,numeric'
round(x,digits)
## S4 method for signature 'gpu.matrix.tensorflow,missing'
round(x,digits)
## S4 method for signature 'gpu.matrix.tensorflow,numeric'
round(x,digits)
Arguments
x |
a |
digits |
integer indicating the number of decimal places (round) or significant digits (signif) to be used. |
Details
The function round
internally calls the corresponding function of the library torch or tensorflow (depending on the type of input gpu.matrix-class).
The behaveour of the function mimics the 'base' function round
. Note that for rounding off a 5, the function will consider "go to the even digit". Therefore, round(2.5) = 2
and round(3.5) = 4
. For more details see round
, and torch_round
.
If the input gpu.matrix-class object is stored on the GPU, then the operations will be performed on the GPU. See gpu.matrix
.
Value
The function will return a gpu.matrix-class object with the rounded values.
See Also
round
, and torch_round
.
Examples
## Not run:
a <- gpu.matrix(rnorm(9),3,3)
round(a,digits = 3) #round to the third digit
## End(Not run)