From a0f9441b383b20f73a8b42c81083afce0f006b76 Mon Sep 17 00:00:00 2001
From: Stephan Seitz <stephan.seitz@fau.de>
Date: Tue, 13 Aug 2019 10:58:35 +0200
Subject: [PATCH] Remove duplicate modules tensorflow/torch

---
 src/pystencils_autodiff/tensorflow.py | 26 --------------------------
 src/pystencils_autodiff/torch.py      | 23 -----------------------
 2 files changed, 49 deletions(-)
 delete mode 100644 src/pystencils_autodiff/tensorflow.py
 delete mode 100644 src/pystencils_autodiff/torch.py

diff --git a/src/pystencils_autodiff/tensorflow.py b/src/pystencils_autodiff/tensorflow.py
deleted file mode 100644
index 91a8c76..0000000
--- a/src/pystencils_autodiff/tensorflow.py
+++ /dev/null
@@ -1,26 +0,0 @@
-import numpy as np
-
-try:
-    import tensorflow as tf
-except ImportError:
-    pass
-
-
-def tf_constant_from_field(field, init_val=0):
-    return tf.constant(init_val, dtype=field.dtype.numpy_dtype, shape=field.shape, name=field.name + '_constant')
-
-
-def tf_scalar_variable_from_field(field, init_val, constraint=None):
-    var = tf.Variable(init_val, dtype=field.dtype.numpy_dtype, name=field.name + '_variable', constraint=constraint)
-    return var * tf_constant_from_field(field, 1)
-
-
-def tf_variable_from_field(field, init_val=0, constraint=None):
-    if isinstance(init_val, (int, float)):
-        init_val *= np.ones(field.shape, field.dtype.numpy_dtype)
-
-    return tf.Variable(init_val, dtype=field.dtype.numpy_dtype, name=field.name + '_variable', constraint=constraint)
-
-
-def tf_placeholder_from_field(field):
-    return tf.placeholder(dtype=field.dtype.numpy_dtype, name=field.name + '_placeholder', shape=field.shape)
diff --git a/src/pystencils_autodiff/torch.py b/src/pystencils_autodiff/torch.py
deleted file mode 100644
index 918f537..0000000
--- a/src/pystencils_autodiff/torch.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright © 2019 Stephan Seitz <stephan.seitz@fau.de>
-#
-# Distributed under terms of the GPLv3 license.
-
-"""
-
-"""
-
-import numpy as np
-
-try:
-    import torch
-except ImportError:
-    pass
-
-
-def torch_tensor_from_field(field, init_val=0, cuda=True, requires_grad=False):
-    if isinstance(init_val, (int, float)):
-        init_val *= np.ones(field.shape, field.dtype.numpy_dtype)
-    device = torch.device('cuda' if cuda else 'cpu')
-    return torch.tensor(init_val, requires_grad=requires_grad, device=device)
-- 
GitLab