Repository: awslabs/gluonts

Issue:
Tracking: mxnet 1.6
### To update

- [x] documentation
- [x] README.md
- [x] test-dependencies

### Fix

- [x] https://github.com/awslabs/gluon-ts/issues/583

### Other

- [x] Update `numpy~1.18`


Discussion:
Hi gluonts team! We have been using your package in our research with remarkable success. Thank you for all the work that you have put into it.

Unfortunately, we need to use mxnet-1.6 in our system, and we can't use gluonts anymore until it is updated to mxnet-1.6. Do you have a timeline for releasing this update? Thank you!
@gitpaulsmith we don't have a timeline yet, but it appears that #583 is the only blocking issue (yay!). I'll keep you posted as soon as I have more info.

Resolving patch:
diff --git a/src/gluonts/model/seq2seq/_forking_network.py b/src/gluonts/model/seq2seq/_forking_network.py
--- a/src/gluonts/model/seq2seq/_forking_network.py
+++ b/src/gluonts/model/seq2seq/_forking_network.py
@@ -12,7 +12,8 @@
 # permissions and limitations under the License.
 
 # Third-party imports
-from mxnet import gluon, nd
+import mxnet as mx
+from mxnet import gluon
 
 # First-party imports
 from gluonts.block.decoder import Seq2SeqDecoder
@@ -22,8 +23,6 @@
 from gluonts.core.component import validated
 from gluonts.model.common import Tensor
 
-nd_None = nd.array([])
-
 
 class ForkingSeq2SeqNetworkBase(gluon.HybridBlock):
     """
@@ -85,9 +84,9 @@ def hybrid_forward(
         """
 
         # FIXME: can we factor out a common prefix in the base network?
-        feat_static_real = nd_None
-        past_feat_dynamic_real = nd_None
-        future_feat_dynamic_real = nd_None
+        feat_static_real = F.zeros(shape=(1,))
+        past_feat_dynamic_real = F.zeros(shape=(1,))
+        future_feat_dynamic_real = F.zeros(shape=(1,))
 
         enc_output_static, enc_output_dynamic = self.encoder(
             past_target, feat_static_real, past_feat_dynamic_real
@@ -121,16 +120,18 @@ def hybrid_forward(self, F, past_target: Tensor) -> Tensor:
         """
 
         # FIXME: can we factor out a common prefix in the base network?
-        feat_static_real = nd_None
-        past_feat_dynamic_real = nd_None
-        future_feat_dynamic_real = nd_None
+        feat_static_real = F.zeros(shape=(1,))
+        past_feat_dynamic_real = F.zeros(shape=(1,))
+        future_feat_dynamic_real = F.zeros(shape=(1,))
 
         enc_output_static, enc_output_dynamic = self.encoder(
             past_target, feat_static_real, past_feat_dynamic_real
         )
 
         enc_output_static = (
-            nd_None if enc_output_static is None else enc_output_static
+            F.zeros(shape=(1,))
+            if enc_output_static is None
+            else enc_output_static
         )
 
         dec_inp_static, dec_inp_dynamic, _ = self.enc2dec(


Test patch:
diff --git a/test/support/test_jitter.py b/test/support/test_jitter.py
--- a/test/support/test_jitter.py
+++ b/test/support/test_jitter.py
@@ -13,6 +13,7 @@
 
 # Standard library imports
 import math
+import sys
 
 # First-party imports
 from gluonts.core.component import check_gpu_support
@@ -30,6 +31,10 @@
 # This test verifies that both eigenvalue decomposition and iterative jitter method
 # make a non-positive definite matrix positive definite to be able to compute the cholesky.
 # Both gpu and cpu as well as single and double precision are tested.
+@pytest.mark.skipif(
+    sys.platform == "linux",
+    reason=f"skipping since potrf crashes on mxnet 1.6.0 on linux when matrix is not spd",
+)
 @pytest.mark.parametrize("ctx", [mx.Context("gpu"), mx.Context("cpu")])
 @pytest.mark.parametrize("jitter_method", ["iter", "eig"])
 @pytest.mark.parametrize("float_type", [np.float32, np.float64])
@@ -53,6 +58,10 @@ def test_jitter_unit(jitter_method, float_type, ctx) -> None:
 # Without the jitter method, NaNs occurs on the gpu for single and double precision and on the cpu for only single
 # precision.  This test verifies that applying the default jitter method fixes these numerical issues on both cpu
 # and gpu and for single and double precision.
+@pytest.mark.skipif(
+    sys.platform == "linux",
+    reason=f"skipping since potrf crashes on mxnet 1.6.0 on linux when matrix is not spd",
+)
 @pytest.mark.parametrize("ctx", [mx.Context("gpu"), mx.Context("cpu")])
 @pytest.mark.parametrize("jitter_method", ["iter", "eig"])
 @pytest.mark.parametrize("float_type", [np.float32, np.float64])
diff --git a/test/support/test_util.py b/test/support/test_util.py
--- a/test/support/test_util.py
+++ b/test/support/test_util.py
@@ -173,7 +173,10 @@ def hybrid_forward(self, F, x1: Tensor, x2: List[Tensor], my_param):
             y = self.dense_layer(F.broadcast_mul(x2[1], my_param))
             return F.broadcast_add(F.broadcast_mul(x1, x2[0]), y)
 
-    return [TestBlock1, TestBlock2, TestBlock3, TestBlock4]
+    # TODO TestBlock1 is broken when using mxnet 1.6 on linux
+    # TODO which apparently doesn't like that x2[1] is not used
+    # return [TestBlock1, TestBlock2, TestBlock3, TestBlock4]
+    return [TestBlock2, TestBlock3, TestBlock4]
 
 
 @pytest.mark.parametrize(