from __future__ import absolute_import

import torch


def to_numpy(tensor):
    if torch.is_tensor(tensor):
        return tensor.cpu().numpy()
    elif type(tensor).__module__ != 'numpy':
        raise ValueError("Cannot convert {} to numpy array"
                         .format(type(tensor)))
    return tensor


def to_torch(ndarray):
    if type(ndarray).__module__ == 'numpy':
        return torch.from_numpy(ndarray)
    elif not torch.is_tensor(ndarray):
        raise ValueError("Cannot convert {} to torch tensor"
                         .format(type(ndarray)))
    return ndarray


# progress bar
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), "progress"))
from .progress.progress.bar import Bar as Bar


f767460e6a0b81a4863a7696690e00a375c9e09d
<mask token>


def to_numpy(tensor):
    if torch.is_tensor(tensor):
        return tensor.cpu().numpy()
    elif type(tensor).__module__ != 'numpy':
        raise ValueError('Cannot convert {} to numpy array'.format(type(
            tensor)))
    return tensor


<mask token>

<mask token>


def to_numpy(tensor):
    if torch.is_tensor(tensor):
        return tensor.cpu().numpy()
    elif type(tensor).__module__ != 'numpy':
        raise ValueError('Cannot convert {} to numpy array'.format(type(
            tensor)))
    return tensor


def to_torch(ndarray):
    if type(ndarray).__module__ == 'numpy':
        return torch.from_numpy(ndarray)
    elif not torch.is_tensor(ndarray):
        raise ValueError('Cannot convert {} to torch tensor'.format(type(
            ndarray)))
    return ndarray


<mask token>

<mask token>


def to_numpy(tensor):
    if torch.is_tensor(tensor):
        return tensor.cpu().numpy()
    elif type(tensor).__module__ != 'numpy':
        raise ValueError('Cannot convert {} to numpy array'.format(type(
            tensor)))
    return tensor


def to_torch(ndarray):
    if type(ndarray).__module__ == 'numpy':
        return torch.from_numpy(ndarray)
    elif not torch.is_tensor(ndarray):
        raise ValueError('Cannot convert {} to torch tensor'.format(type(
            ndarray)))
    return ndarray


<mask token>
sys.path.append(os.path.join(os.path.dirname(__file__), 'progress'))
<mask token>

from __future__ import absolute_import
import torch


def to_numpy(tensor):
    if torch.is_tensor(tensor):
        return tensor.cpu().numpy()
    elif type(tensor).__module__ != 'numpy':
        raise ValueError('Cannot convert {} to numpy array'.format(type(
            tensor)))
    return tensor


def to_torch(ndarray):
    if type(ndarray).__module__ == 'numpy':
        return torch.from_numpy(ndarray)
    elif not torch.is_tensor(ndarray):
        raise ValueError('Cannot convert {} to torch tensor'.format(type(
            ndarray)))
    return ndarray


import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), 'progress'))
from .progress.progress.bar import Bar as Bar

from __future__ import absolute_import

import torch


def to_numpy(tensor):
    if torch.is_tensor(tensor):
        return tensor.cpu().numpy()
    elif type(tensor).__module__ != 'numpy':
        raise ValueError("Cannot convert {} to numpy array"
                         .format(type(tensor)))
    return tensor


def to_torch(ndarray):
    if type(ndarray).__module__ == 'numpy':
        return torch.from_numpy(ndarray)
    elif not torch.is_tensor(ndarray):
        raise ValueError("Cannot convert {} to torch tensor"
                         .format(type(ndarray)))
    return ndarray


# progress bar
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), "progress"))
from .progress.progress.bar import Bar as Bar

