Skip to content

Commit

Permalink
Add more protection in questionable places.
Browse files Browse the repository at this point in the history
  • Loading branch information
liuliu committed Mar 29, 2024
1 parent 153313f commit f6d1648
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

git_repository(
name = "ccv",
commit = "b0e09d06919596ff20f6596ab90eb41a24e9306a",
commit = "83a26830569428cb059d507d79facf8e11aa90e1",
remote = "https://github.com/liuliu/ccv.git",
shallow_since = "1711131911 -0400",
shallow_since = "1711755104 -0400",
)

load("@ccv//config:ccv.bzl", "ccv_deps", "ccv_setting")
Expand Down
4 changes: 2 additions & 2 deletions deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def s4nnc_deps():
git_repository,
name = "ccv",
remote = "https://github.com/liuliu/ccv.git",
commit = "b0e09d06919596ff20f6596ab90eb41a24e9306a",
shallow_since = "1711131911 -0400",
commit = "83a26830569428cb059d507d79facf8e11aa90e1",
shallow_since = "1711755104 -0400",
)

_maybe(
Expand Down
6 changes: 4 additions & 2 deletions nnc/FunctionalAddons.swift
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ extension DynamicGraph.Tensor {
var _output: ccv_nnc_tensor_variable_t? = output._tensor
ccv_nnc_dynamic_graph_exec(
_graph, cmd, ccv_nnc_no_hint, 0, &_input, 1, &_output, 1, 0, _streamContext)
withExtendedLifetime((v, output)) {}
}
}

Expand Down Expand Up @@ -487,6 +488,7 @@ extension DynamicGraph.Tensor {
var _output: ccv_nnc_tensor_variable_t? = output._tensor
ccv_nnc_dynamic_graph_exec(
_graph, cmd, ccv_nnc_no_hint, 0, &_input, 1, &_output, 1, 0, _streamContext)
withExtendedLifetime((v, output)) {}
}
}

Expand Down Expand Up @@ -710,7 +712,7 @@ extension DynamicGraph.Group where Element: DynamicGraph.AnyTensor {
_graph, cmd, ccv_nnc_no_hint, 0, _inputs, outputSize, _outputs, outputSize, outputSize,
_streamContext)
_outputs.deallocate()
withExtendedLifetime(v) {}
withExtendedLifetime((v, outputs)) {}
}
}

Expand Down Expand Up @@ -770,7 +772,7 @@ extension DynamicGraph.Group where Element: DynamicGraph.AnyTensor {
_graph, cmd, ccv_nnc_no_hint, 0, _inputs, outputSize, _outputs, outputSize, outputSize,
_streamContext)
_outputs.deallocate()
withExtendedLifetime(v) {}
withExtendedLifetime((v, outputs)) {}
}
}

Expand Down
2 changes: 2 additions & 0 deletions nnc/Tensor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@ extension AnyTensorStorage {
CCV_NNC_FORMAT_TRANSFORM_FORWARD, nil, CmdParamsFactory.factory.newParams(), 0),
ccv_nnc_no_hint, 0, &input, 1, &output, 1, nil)
}
withExtendedLifetime(v) {}
}
}
}
Expand Down Expand Up @@ -661,6 +662,7 @@ extension AnyTensorStorage {
CCV_NNC_DATA_TRANSFER_FORWARD, nil, CmdParamsFactory.factory.newParams(), 0),
ccv_nnc_no_hint, 0, &input, 1, &output, 1, nil)
}
withExtendedLifetime(v) {}
}
}
}
Expand Down

0 comments on commit f6d1648

Please sign in to comment.