MCPcopy Create free account
hub / github.com/pytorch/pytorch / renderTensor

Method renderTensor

torch/utils/model_dump/code.js:195–226  ·  view source on GitHub ↗
(
      prefix,
      dtype,
      storage_key,
      device,
      storage_numel,
      offset,
      size,
      stride,
      grad,
      extra_parts)

Source from the content-addressed store, hash-verified

193 }
194
195 renderTensor(
196 prefix,
197 dtype,
198 storage_key,
199 device,
200 storage_numel,
201 offset,
202 size,
203 stride,
204 grad,
205 extra_parts) {
206 let parts = [
207 "(" + size.join(",") + ")",
208 dtype,
209 ];
210 parts.push(...extra_parts);
211 if (device != "cpu") {
212 parts.push(device);
213 }
214 if (grad) {
215 parts.push("grad");
216 }
217 // TODO: Check stride and indicate if the tensor is channels-last or non-contiguous
218 // TODO: Check size, stride, offset, and numel and indicate if
219 // the tensor doesn't use all data in storage.
220 // TODO: Maybe show key?
221 void(offset);
222 void(stride);
223 void(storage_key);
224 void(storage_numel);
225 return prefix + "(" + parts.join(", ") + ")";
226 }
227
228 renderBody(indent, data) {
229 if (data === null || this.INLINE_TYPES.has(typeof(data))) {

Callers 1

renderHeadlineMethod · 0.95

Calls 2

joinMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected