giagrad.Tensor.comm#

classmethod Tensor.comm(function: Function, *tensors) Tensor[source]#

Returns a new instance of an autodifferentiable tensor given a giagrad.tensor.Function.

comm creates a tensor with the output of forward().

For developer use.

Parameters:
  • *tensors (array_like, ...) – Internally comm transforms any object in *tensors to a Tensor and passes it to forward().

  • *kwargs – Optional arguments passed to the forward() method of the fn parameter.

Examples

>>> from giagrad.mlops import Softmax
>>> t = Tensor.empty(2, 3).uniform(-1, 1)
>>> t
tensor: [[ 0.27639335  0.7524293   0.69203097]
         [ 0.37772807 -0.9291505  -0.80418533]]
>>> Tensor.comm(Softmax(axis=1), t)
tensor: [[0.24242324 0.390224   0.36735278]
         [0.6339727  0.17159334 0.19443396]] fn: Softmax(axis=1)