How to use the eagerpy.tensor.base.wrapout function in eagerpy

To help you get started, we’ve selected a few eagerpy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jonasrauber / eagerpy / eagerpy / tensor / numpy.py View on Github external
    @wrapout
    def maximum(self, other):
        return self.backend.maximum(self.tensor, other)
github jonasrauber / eagerpy / eagerpy / tensor / pytorch.py View on Github external
    @wrapout
    def _stack(self, tensors, axis=0):
        # stacks only "tensors", but not "self"
        tensors = [t.tensor if isinstance(t, self.__class__) else t for t in tensors]
        return self.backend.stack(tensors, dim=axis)
github jonasrauber / eagerpy / eagerpy / tensor / pytorch.py View on Github external
    @wrapout
    def any(self, axis=None, keepdims=False):
        assert self.dtype == self.backend.bool
        if axis is None:
            assert not keepdims
            return self.tensor.any()
        if not isinstance(axis, Iterable):
            axis = (axis,)
        axis = reversed(sorted(axis))
        x = self.tensor
        for i in axis:
            x = x.any(i, keepdim=keepdims)
        return x
github jonasrauber / eagerpy / eagerpy / tensor / pytorch.py View on Github external
    @wrapout
    def _concatenate(self, tensors, axis=0):
        # concatenates only "tensors", but not "self"
        tensors = [t.tensor if isinstance(t, self.__class__) else t for t in tensors]
        return self.backend.cat(tensors, dim=axis)
github jonasrauber / eagerpy / eagerpy / tensor / pytorch.py View on Github external
    @wrapout
    def logical_not(self):
        assert self.dtype == self.backend.bool
        return ~self.tensor
github jonasrauber / eagerpy / eagerpy / tensor / tensorflow.py View on Github external
    @wrapout
    def logical_not(self):
        assert self.dtype == self.backend.bool
        return self.backend.logical_not(self.tensor)
github jonasrauber / eagerpy / eagerpy / tensor / pytorch.py View on Github external
    @wrapout
    def argsort(self, axis=-1):
        return self.tensor.argsort(dim=axis)
github jonasrauber / eagerpy / eagerpy / tensor / numpy.py View on Github external
    @wrapout
    def argmin(self, axis=None):
        return self.tensor.argmin(axis=axis)
github jonasrauber / eagerpy / eagerpy / tensor / jax.py View on Github external
    @wrapout
    def _stack(self, tensors, axis=0):
        # stacks only "tensors", but not "self"
        tensors = [t.tensor if isinstance(t, self.__class__) else t for t in tensors]
        return self.backend.stack(tensors, axis=axis)
github jonasrauber / eagerpy / eagerpy / tensor / tensorflow.py View on Github external
    @wrapout
    def tile(self, multiples):
        assert len(multiples) == self.ndim
        return self.backend.tile(self.tensor, multiples)

eagerpy

EagerPy is a thin wrapper around PyTorch, TensorFlow Eager, JAX and NumPy that unifies their interface and thus allows writing code that works natively across all of them.

MIT
Latest version published 3 years ago

Package Health Score

46 / 100
Full package analysis