Tensor.new_log2

Tensor.new_log2()

Return a new tensor with the base-2 logarithm applied to each element.

Returns:

new tensor

Return type:

Tensor

Example

import pyagrum as gum

a = gum.LabelizedVariable("a", "a", 3)
p = gum.Tensor().add(a).fillWith([1, 2, 8])
p.new_log2().tolist()
# [0.0, 1.0, 3.0]
p.tolist()  # p is unchanged
# [1.0, 2.0, 8.0]

Class

Tensor