gigasquid commented on a change in pull request #13993: [Clojure] Add resource scope to clojure package URL: https://github.com/apache/incubator-mxnet/pull/13993#discussion_r251132120
########## File path: contrib/clojure-package/test/org/apache/clojure_mxnet/resource_scope_test.clj ########## @@ -0,0 +1,65 @@ +;; +;; Licensed to the Apache Software Foundation (ASF) under one or more +;; contributor license agreements. See the NOTICE file distributed with +;; this work for additional information regarding copyright ownership. +;; The ASF licenses this file to You under the Apache License, Version 2.0 +;; (the "License"); you may not use this file except in compliance with +;; the License. You may obtain a copy of the License at +;; +;; http://www.apache.org/licenses/LICENSE-2.0 +;; +;; Unless required by applicable law or agreed to in writing, software +;; distributed under the License is distributed on an "AS IS" BASIS, +;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +;; See the License for the specific language governing permissions and +;; limitations under the License. +;; + +(ns org.apache.clojure-mxnet.resource-scope-test + (:require [org.apache.clojure-mxnet.ndarray :as ndarray] + [org.apache.clojure-mxnet.symbol :as sym] + [org.apache.clojure-mxnet.resource-scope :as resource-scope] + [clojure.test :refer :all])) + +(deftest test-resource-scope-with-ndarray + (let [x (ndarray/ones [2 2]) + return-val (resource-scope/using + (def temp-x (ndarray/ones [3 1])) + (def temp-y (ndarray/ones [3 1])) + (let [z {:just-a-test (def temp-z (ndarray/ones [3 3]))} Review comment: I agree the def are weird - do you think an atom with a map of ndarrays under test that could be `swap` ed in would be better? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
