Skip to content

Commit f81d448

Browse files
committed
[OPS] Added a check for 'stack' that avoids an ugly segfault.
1 parent 152eeed commit f81d448

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

RELEASE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 0.6.2
2+
3+
- Added a check for the `stack` operation that avoids an
4+
ugly segfault.
5+
16
# 0.6.1
27

38
- `Session.run` no longer locks.

modules/api/src/main/scala/org/platanios/tensorflow/api/learn/SessionCreator.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ case class ChiefSessionCreator(
7070
if (extraInitOps.isEmpty)
7171
builtSessionScaffold.initOp
7272
else
73-
ControlFlow.group(extraInitOps.toSet + builtSessionScaffold.localInitOp, name = "Init").asUntyped
73+
ControlFlow.group(extraInitOps.toSet + builtSessionScaffold.initOp, name = "Init").asUntyped
7474
}
7575

7676
override protected lazy val localInitOp: UntypedOp = {

modules/api/src/main/scala/org/platanios/tensorflow/api/ops/basic/Manipulation.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ trait Manipulation {
300300
axis: Int = 0,
301301
name: String = "Stack"
302302
): Output[T] = {
303+
require(inputs.nonEmpty, "Cannot stack an empty Seq[Output].")
303304
Op.Builder[Seq[Output[T]], Output[T]](
304305
opType = "Pack",
305306
name = name,

modules/api/src/main/scala/org/platanios/tensorflow/api/tensors/ops/Basic.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ trait Basic {
137137
inputs: Seq[Tensor[T]],
138138
axis: Int = 0
139139
): Tensor[T] = {
140+
require(inputs.nonEmpty, "Cannot stack an empty Seq[Tensor].")
140141
Tensor.fromNativeHandle[T](NativeTensorOpsBasic.pack(
141142
executionContext.value.nativeHandle, inputs.map(_.nativeHandle).toArray, axis))
142143
}

0 commit comments

Comments
 (0)