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

Method expando

torch/utils/model_dump/code.js:113–142  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

111 }
112
113 expando(data) {
114 if (data === null || this.INLINE_TYPES.has(typeof(data))) {
115 return false;
116 }
117 if (typeof(data) != "object") {
118 throw new Error("Not an object");
119 }
120 if (Array.isArray(data)) {
121 // TODO: Maybe show simple lists and tuples on one line.
122 return true;
123 }
124 if (data.__tuple_values__) {
125 // TODO: Maybe show simple lists and tuples on one line.
126 return true;
127 }
128 if (data.__is_dict__) {
129 // TODO: Maybe show simple (empty?) dicts on one line.
130 return true;
131 }
132 if (data.__module_type__) {
133 return true;
134 }
135 if (data.__tensor_v2__) {
136 return false;
137 }
138 if (data.__qtensor__) {
139 return false;
140 }
141 throw new Error("Can't handle data type.", data);
142 }
143
144 renderHeadline(data) {
145 if (data === null) {

Callers 1

renderMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected