HyperGP.tensor.min

Contents

HyperGP.tensor.min#

min(x, dim=0)[source]#

Min value of the array elements along with the corresponding dim.

Parameters:
  • x (Tensor or array_like) – Elements to search for min values.

  • dim – The dim of x which a ‘min’ is performed.

Returns:

a new ‘Tensor’ is returned

Examples

import modules

>>> import numpy as np
>>> from HyperGP import Tensor
>>> import time

array initialization

>>> x1 = np.random.uniform(-1, 1, size=(500, 100000))
>>> x1_t = Tensor(x1)

runtime test

>>> st = time.time()
>>> ar = [np.min(x1) for i in range(10)]
>>> print("numpy runtime: ", time.time() - st)
>>> st = time.time()
>>> ar = [HyperGP.min(x1_t) for i in range(10)]
>>> print("HyperGP runtime: ", time.time() - st)

broadcast operation

>>> ar = [x1 + x2 for i in range(10)]
>>> ar = [HyperGP.min(x1_t, dim=1) for i in range(10)]
>>> for x in ar:
...     x.wait()