Skip to content

Commit

Permalink
review_change
Browse files Browse the repository at this point in the history
  • Loading branch information
KexinFeng committed Jun 8, 2023
1 parent d4eb8cc commit f8dfab6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
6 changes: 3 additions & 3 deletions api/src/main/java/ai/djl/util/NativeResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ public void onClose() {
* @param manager the NDManager to attach NDArrays to
* @return the {@code NDList} of this NativeResource
*/
public NDList toNDList(NDManager manager) {
throw new UnsupportedOperationException("Not implemented.");
}
// public NDList toNDList(NDManager manager) {
// throw new UnsupportedOperationException("Not implemented.");
// }

/** {@inheritDoc} */
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ public CausalLMOutput forward(NDList input, NDList pastKeyValues, NDManager mana

NDArray logitsOutput = output.get(0);
NDList pastKeyValuesOutput = output.subList(1, config.getNumLayers() * 2 + 1);
NDArray hiddenStatesOutput = new NDList();
if (output.size > config.getNumLayers() * 2 + 2) {
NDArray hiddenStatesOutput = manager.zeros(new Shape(1));
if (output.size() > config.getNumLayers() * 2 + 2) {
hiddenStatesOutput = output.subNDList(config.getNumLayers() * 2 + 2).get(0);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,12 @@ public IValue[] toIValueTuple() {
return ret;
}

/** {@inheritDoc} */
@Override
/**
* Returns the {@code NDList} value of this NativeResource.
*
* @param ndManager the NDManager to attach NDArrays to
* @return the {@code NDList} of this NativeResource
*/
public NDList toNDList(NDManager ndManager) {
PtNDManager manager = (PtNDManager) ndManager;
if (isTensor()) {
Expand Down

0 comments on commit f8dfab6

Please sign in to comment.