From 424cd060f5b06e3bc8b6f94c9c43ab5e3b4707d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Reboud?= Date: Wed, 9 Aug 2023 18:07:00 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20input=20GPU=20check=20(#1?= =?UTF-8?q?06)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ Sources/GrAIdient/Layer1D/Base/LayerInput1D.swift | 2 +- Sources/GrAIdient/Layer2D/Base/LayerInput2D.swift | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6f5db04..4564bb16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. ## [unreleased] +## 0.3.1 (2023-08-09) + +### Bug Fixes + +🐛 **fix**: input GPU check ([#106](https://github.com/owkin/GrAIdient/pull/106)) + ## 0.3.0 (2023-08-04) ### Features diff --git a/Sources/GrAIdient/Layer1D/Base/LayerInput1D.swift b/Sources/GrAIdient/Layer1D/Base/LayerInput1D.swift index d34977af..fbc22d41 100644 --- a/Sources/GrAIdient/Layer1D/Base/LayerInput1D.swift +++ b/Sources/GrAIdient/Layer1D/Base/LayerInput1D.swift @@ -136,7 +136,7 @@ open class LayerInput1D: Layer1D batchSize: Int, nbNeurons: Int) throws { - if data.nbElems > batchSize * nbNeurons + if batchSize * nbNeurons > data.nbElems { throw LayerError.DataSize } diff --git a/Sources/GrAIdient/Layer2D/Base/LayerInput2D.swift b/Sources/GrAIdient/Layer2D/Base/LayerInput2D.swift index ed3532f7..3d8caf2c 100644 --- a/Sources/GrAIdient/Layer2D/Base/LayerInput2D.swift +++ b/Sources/GrAIdient/Layer2D/Base/LayerInput2D.swift @@ -199,7 +199,7 @@ open class LayerInput2D: Layer2D batchSize: Int, nbChannels: Int, height: Int, width: Int) throws { - if data.nbElems > batchSize * nbChannels * height * width + if batchSize * nbChannels * height * width > data.nbElems { throw LayerError.DataSize }