def vcall(self, module: 'values.Field', graph: 'graphs.Graph', inst: 'values.Object', args: 'functions.FunctionArgInput', option: 'vevaluator.VEvalContext' = None, line=-1): funcArgs = self.args.merge_inputs(inst, args) node = nodes.NodeCall(self, funcArgs, line) if inst.in_container: raise Exception('Invalid operation') old_v = inst.get_value() new_v = functions.generate_value_with_same_type(old_v) # estimate a type contained if old_v.has_constant_value(): new_v.internal_value = list(old_v.internal_value) for v in funcArgs.inputs[1:]: new_v.append(v) # update value inst.revise(new_v) new_v.name = '@F.{}.{}'.format(line, self.name) node.set_outputs([new_v]) graph.add_node(node) return values.NoneValue()
def vcall(self, module: 'Field', graph: 'Graph', inst: 'values.ValueRef', args: 'functions.FunctionArgInput', line=-1): funcArgs = self.args.merge_inputs(inst, args) node = nodes.NodeCall(self, funcArgs, line) graph.add_node(node) #value = functions.generate_value_with_same_type(vargs[0]) value = self.ret_value_func() value.name = '@F.{}.{}'.format(line, self.name) node.set_outputs([value]) return values.ValueRef(value)
def vcall(self, module: 'values.Field', graph: 'graphs.Graph', inst: 'values.Object', args: 'functions.FunctionArgInput', context: 'functions.VEvalContext' = None, line=-1): funcArgs = self.args.merge_inputs(inst, args) node = nodes.NodeCall(self, funcArgs, line) graph.add_node(node)
def vcall(self, module: 'values.Field', graph: 'graphs.Graph', inst: 'values.Object', args: 'functions.FunctionArgInput', context: 'functions.VEvalContext' = None, line=-1): funcArgs = self.args.merge_inputs(inst, args) vargs = funcArgs.get_value().inputs node = nodes.NodeCall(self, funcArgs, line) graph.add_node(node) value = functions.generate_value_with_same_type(vargs[0]) value.name = '@F.{}.{}'.format(line, self.name) node.set_outputs([value]) return values.Object(value)
def vcall(self, module: 'Field', graph: 'Graph', inst: 'values.ValueRef', args: 'functions.FunctionArgInput', line=-1): args = functions.FunctionArgInput() args.inputs.append(inst) args.keywords['self'] = inst node = nodes.NodeCall(self, args, line) value = values.TupleValue() value.name = '@F.{}.{}'.format(line, self.name) node.set_outputs([value]) graph.add_node(node) return values.ValueRef(value)
def vcall(self, module: 'values.Field', graph: 'graphs.Graph', inst: 'values.Object', args: 'functions.FunctionArgInput', context: 'functions.VEvalContext' = None, line=-1): node = nodes.NodeCall(self, args, line) graph.add_node(node) item = args.get_value().inputs[0] default_value = None # constant propagation whenever possible if item.has_constant_value(): default_value = len(item.internal_value) value = values.NumberValue(default_value) value.name = '@F.{}.{}'.format(line, self.name) node.set_outputs([value]) return values.Object(value)
def vcall(self, module: 'values.Field', graph: 'graphs.Graph', inst: 'values.Object', args: 'functions.FunctionArgInput', context: 'functions.VEvalContext' = None, line=-1): args = functions.FunctionArgInput() args.inputs.append(inst) args.keywords['self'] = inst node = nodes.NodeCall(self, args, line) value = values.NumberValue(None) value.dtype = np.array(0).dtype value.name = '@F.{}.{}'.format(line, self.name) node.set_outputs([value]) graph.add_node(node) return values.Object(value)
def vcall(self, module: 'values.Field', graph: 'graphs.Graph', inst: 'values.Object', args: 'functions.FunctionArgInput', option: 'vevaluator.VEvalContext' = None, line=-1): chainer_link = chainer_links[type(self.owner.inst)] if len(self.args.args_list) == 0: if chainer_link.args is None: self.args.add_arg('self', None) self.args.add_arg('x', None) else: for arg in chainer_link.args: self.args.add_arg(arg[0], arg[1]) vargs = self.args.merge_inputs(inst, args) node = nodes.NodeCall(self, vargs, line) graph.add_node(node) if chainer_link.get_ret is not None: ret = chainer_link.get_ret() node.set_outputs(ret) return values.Object( values.TupleValue([values.Object(v) for v in ret])) else: value = values.TensorValue() estimate_shape = chainer_links[type( self.owner.inst)].estimate_shape if estimate_shape is not None: value.shape = estimate_shape(self.owner.inst, vargs) node.set_outputs([value]) return values.Object(value)
def vcall(self, module: 'values.Field', graph: 'graphs.Graph', inst: 'values.Object', args: 'functions.FunctionArgInput', context: 'functions.VEvalContext' = None, line=-1): funcArgs = self.args.merge_inputs(inst, args) node = nodes.NodeCall(self, funcArgs, line) graph.add_node(node) axis = funcArgs.keywords['axis'] if isinstance(axis, values.NoneValue): value = values.NumberValue(None) value.dtype = np.int64 else: value = values.TensorValue() value.dtype = np.int64 value.name = '@F.{}.{}'.format(line, self.name) node.set_outputs([value]) return values.Object(value)