Repository: Theano/Theano

Issue:
Updating documentation on shared variables
You can make a pull request to Theano github repo in order to fix a bug or add new features.
Once a pull request is submitted, [Travis](https://travis-ci.org/) is launched to verify the pull request
given the current stack of unit-tests in Theano.

Updating documentation on shared variables.



Discussion:

Resolving patch:
diff --git a/theano/compile/sharedvalue.py b/theano/compile/sharedvalue.py
--- a/theano/compile/sharedvalue.py
+++ b/theano/compile/sharedvalue.py
@@ -120,6 +120,31 @@ def set_value(self, new_value, borrow=False):
         Changes to this value will be visible to all functions using
         this SharedVariable.
 
+        Notes
+        -----
+        Set_value will work in-place on the GPU, if
+        the following conditions are met:
+
+            * The destination on the GPU must be c_contiguous.
+            * The source is on the CPU.
+            * The old value must have the same dtype as the new value
+              (which is a given for now, since only float32 is
+              supported).
+            * The old and new value must have the same shape.
+            * The old value is being completely replaced by the new
+              value (not partially modified, e.g. by replacing some
+              subtensor of it).
+            * You change the value of the shared variable via
+              set_value, not via the .value accessors. You should not
+              use the .value accessors anyway, since they will soon be
+              deprecated and removed.
+
+        It is also worth mentioning that, for efficient transfer to the GPU,
+        Theano will make the new data ``c_contiguous``. This can require an
+        extra copy of the data on the host.
+
+        The inplace on gpu memory work when borrow is either True or False.
+
         """
         if borrow:
             self.container.value = new_value
diff --git a/theano/sandbox/cuda/var.py b/theano/sandbox/cuda/var.py
--- a/theano/sandbox/cuda/var.py
+++ b/theano/sandbox/cuda/var.py
@@ -79,24 +79,6 @@ def get_value(self, borrow=False, return_internal_type=False):
         """
         Return the value of this SharedVariable's internal array.
 
-        Parameters
-        ----------
-        borrow
-            Permit the return of internal storage, when used in conjunction with
-            ``return_internal_type=True``.
-        return_internal_type
-            True to return the internal ``cuda_ndarray`` instance rather than a
-            ``numpy.ndarray`` (Default False).
-
-        By default ``get_value()`` copies from the GPU to a ``numpy.ndarray``
-        and returns that host-allocated array.
-
-        ``get_value(False,True)`` will return a GPU-allocated copy of the
-        original GPU array.
-
-        ``get_value(True,True)`` will return the original GPU-allocated array
-        without any copying.
-
         """
         if return_internal_type or not self.get_value_return_ndarray:
             # return a cuda_ndarray
@@ -111,42 +93,6 @@ def set_value(self, value, borrow=False):
         """
         Assign `value` to the GPU-allocated array.
 
-        Parameters
-        ----------
-        borrow : bool
-            ``True`` permits reusing `value` itself, ``False`` requires that
-            this function copies `value` into internal storage.
-
-        Notes
-        -----
-        Prior to Theano 0.3.1, set_value did not work in-place on the GPU. This
-        meant that sometimes, GPU memory for the new value would be allocated
-        before the old memory was released. If you're running near the limits of
-        GPU memory, this could cause you to run out of GPU memory.
-
-        Beginning with Theano 0.3.1, set_value will work in-place on the GPU, if
-        the following conditions are met:
-
-            * The destination on the GPU must be c_contiguous.
-            * The source is on the CPU.
-            * The old value must have the same dtype as the new value
-              (which is a given for now, since only float32 is
-              supported).
-            * The old and new value must have the same shape.
-            * The old value is being completely replaced by the new
-              value (not partially modified, e.g. by replacing some
-              subtensor of it).
-            * You change the value of the shared variable via
-              set_value, not via the .value accessors. You should not
-              use the .value accessors anyway, since they will soon be
-              deprecated and removed.
-
-        It is also worth mentioning that, for efficient transfer to the GPU,
-        Theano will make the new data ``c_contiguous``. This can require an
-        extra copy of the data on the host.
-
-        The inplace on gpu memory work when borrow is either True or False.
-
         """
         if not borrow:
             # TODO: check for cuda_ndarray type


Test patch: