Returns the mode value of each row of the x tensor in the given dimension dim. Also returns the index location of the mode value as a LongTensor. By default, dim is the last dimension of the x tensor.
tch_mode(x, dim = -1, keepdim = FALSE)
x | tensor object |
---|---|
dim | the dimension to reduce |
keepdim | wether to keep or not the dim |
#> [[1]] #> tensor #> 1 #> 2 #> 3 #> 4 #> 5 #> [ Variable[CPUIntType]{5} ] #> #> [[2]] #> tensor #> 0 #> 0 #> 0 #> 0 #> 0 #> [ Variable[CPULongType]{5} ] #>tch_mode(x, 0)#> [[1]] #> tensor #> 1 #> 6 #> 11 #> 16 #> [ Variable[CPUIntType]{4} ] #> #> [[2]] #> tensor #> 0 #> 0 #> 0 #> 0 #> [ Variable[CPULongType]{4} ] #>tch_mode(x, 1)#> [[1]] #> tensor #> 1 #> 2 #> 3 #> 4 #> 5 #> [ Variable[CPUIntType]{5} ] #> #> [[2]] #> tensor #> 0 #> 0 #> 0 #> 0 #> 0 #> [ Variable[CPULongType]{5} ] #>