Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions 2 Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ RUN apt-get -y install zlib1g-dev liblcms2-dev libwebp-dev libgeos-dev && \
# MXNet
pip install mxnet && \
pip install --upgrade numpy && \
pip install gluonnlp && \
pip install gluoncv && \
# h2o (requires java)
# requires java
apt-get install -y default-jdk && \
Expand Down
3 changes: 3 additions & 0 deletions 3 gpu.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ RUN pip uninstall -y tensorflow && \
conda install -y pytorch torchvision -c pytorch && \
/tmp/clean-layer.sh

RUN pip uninstall -y mxnet && \
pip install mxnet-cu92

# Install GPU-only packages
RUN pip install pycuda && \
pip install cupy-cuda92 && \
Expand Down
37 changes: 37 additions & 0 deletions 37 tests/test_mxnet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import unittest
from common import gpu_test

import mxnet as mx
from gluonnlp import Vocab
from gluonnlp.data import count_tokens

from gluoncv.data.transforms.image import imresize


class TestMxNet(unittest.TestCase):
def test_array(self):
x = mx.nd.array([[1, 2, 3], [4, 5, 6]])

self.assertEqual((2, 3), x.shape)

@gpu_test
def test_array_gpu(self):
x = mx.nd.array([2, 2, 2], ctx=mx.gpu(0))
y = mx.nd.array([1, 1, 1], ctx=mx.gpu(0))
self.assertEqual(3, ((x - y).sum().asscalar()))

def test_gluon_nlp(self):
# get corpus statistics
counter = count_tokens(['alpha', 'beta', 'gamma', 'beta'])
# create Vocab
vocab = Vocab(counter)
# find index based on token
self.assertEqual(4, vocab['beta'])

def test_gluon_cv(self):
# create fake RGB image of 300x300 of shape: Height x Width x Channel as OpenCV expects
img = mx.random.uniform(0, 255, (300, 300, 3)).astype('uint8')
# resize image to 200x200. This call uses OpenCV
# GluonCV is not of much use if OpenCV is not there or fails
img = imresize(img, 200, 200)
self.assertEqual((200, 200, 3), img.shape)
9 changes: 0 additions & 9 deletions 9 tests/text_mxnet.py

This file was deleted.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.