Skip to content

Commit 423a697

Browse files
committed
Fix timing reporting in style transfer demo.
1 parent 57347f7 commit 423a697

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

demos/video/chapel-webcam/smol.chpl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ export proc getNewFrame(ref frame: [] real(32),height: int, width: int,channels:
124124
const currentWindowSize = min(frameCount, windowSize);
125125
const windowAvgFPS = windowSum / currentWindowSize;
126126
writeln("FPS: ", fps, " avg FPS: ", windowAvgFPS, "max window FPS: ", max reduce fpsBuffer);
127+
lastFrame = getTime();
128+
127129

128130
const shape = (height,width,channels);
129131
const frameDom = util.domainFromShape((...shape));
@@ -138,7 +140,6 @@ export proc getNewFrame(ref frame: [] real(32),height: int, width: int,channels:
138140
const dtInput = new dynamicTensor(ndframe); // 20 fps
139141
const dtOutput = modelLayer!.forward(dtInput);
140142
const outputFrame = dtOutput.flatten().toArray(1);
141-
lastFrame = getTime();
142143
return outputFrame;
143144

144145
// 2 (no)
@@ -150,13 +151,11 @@ export proc getNewFrame(ref frame: [] real(32),height: int, width: int,channels:
150151
// const dtInput = new dynamicTensor(ndframe); // 20 fps
151152
// const dtOutput = modelLayer!.forward(dtInput);
152153
// const outputFrame = dtOutput.flatten().toArray(1);
153-
// lastFrame = getTime();
154154
// return outputFrame;
155155
// } else {
156156
// const dtInput = (new dynamicTensor(frame)).reshape((...shape));
157157
// const dtOutput = modelLayer!.forward(dtInput);
158158
// const outputFrame = dtOutput.flatten().toArray(1);
159-
// lastFrame = getTime();
160159
// return outputFrame;
161160
// }
162161

@@ -166,7 +165,6 @@ export proc getNewFrame(ref frame: [] real(32),height: int, width: int,channels:
166165
// const dtOutput = modelLayer!.forward(dtInput);
167166
// // const outputFrame = dtOutput.rankedData(1);
168167
// const outputFrame = dtOutput.flatten().toArray(1);
169-
// lastFrame = getTime();
170168
// return outputFrame;
171169
} else {
172170
var btFrame: Bridge.bridge_tensor_t = Bridge.createBridgeTensorWithShape(frame,shape);
@@ -178,7 +176,6 @@ export proc getNewFrame(ref frame: [] real(32),height: int, width: int,channels:
178176

179177
const nextNDFrame = bt : ndarray(3, real(32));
180178
const flattenedNextFrame = nextNDFrame.flatten().data;
181-
lastFrame = getTime();
182179
return flattenedNextFrame;
183180
}
184181

0 commit comments

Comments
 (0)