MCPcopy
hub / github.com/lutzroeder/netron / emitSliceOp

Method emitSliceOp

source/python.js:17909–17932  ·  view source on GitHub ↗
(loc, sliceable, dim, start, end, step)

Source from the content-addressed store, hash-verified

17907 return this.graph.insertNode(this.graph.createTupleSlice(tuple_val.value(this.graph), beg._, step_size, num_values)).output();
17908 }
17909 emitSliceOp(loc, sliceable, dim, start, end, step) {
17910 const args = [];
17911 args.push(new torch._C.NamedValue(loc, 'self', sliceable));
17912 if (dim) {
17913 torch._C.AT_ASSERT(sliceable.type().isSubtypeOf(torch.TensorType.get()));
17914 args.emplace_back(new torch._C.NamedValue(dim));
17915 } else {
17916 torch._C.AT_ASSERT(!sliceable.type().isSubtypeOf(torch.TensorType.get()));
17917 }
17918 if (sliceable.type() instanceof torch.TupleType) {
17919 const tuple_args = [];
17920 tuple_args.push(start ? new torch._C.NamedValue(start) : null);
17921 tuple_args.push(end ? new torch._C.NamedValue(end) : null);
17922 tuple_args.push(step ? new torch._C.NamedValue(step) : null);
17923 return this.emitTupleSlice(loc, args[0], tuple_args);
17924 }
17925 if (!step) {
17926 step = this.graph.insertConstant(1, loc);
17927 }
17928 args.push(new torch._C.NamedValue(loc, 'start', start));
17929 args.push(new torch._C.NamedValue(loc, 'end', end));
17930 args.push(new torch._C.NamedValue(loc, 'step', step));
17931 return this.emitBuiltinCall(loc, this.graph, 'aten::slice', args, []);
17932 }
17933 emitSlice(loc, input, dim, slice) {
17934 let start = null;
17935 let end = null;

Callers 2

emitSliceMethod · 0.80
emitSubscriptMethod · 0.80

Calls 6

isSubtypeOfMethod · 0.80
emitTupleSliceMethod · 0.80
insertConstantMethod · 0.80
pushMethod · 0.45
typeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected