MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / set_variable_data

Function set_variable_data

python/paddle/static/quantization/utils.py:126–136  ·  view source on GitHub ↗

Set the value of var node by name, if the node exits,

(scope, place, var_name, np_value)

Source from the content-addressed store, hash-verified

124
125
126def set_variable_data(scope, place, var_name, np_value):
127 '''
128 Set the value of var node by name, if the node exits,
129 '''
130 assert isinstance(np_value, np.ndarray), (
131 'The type of value should be numpy array.'
132 )
133 var_node = scope.find_var(var_name)
134 if var_node is not None:
135 tensor = var_node.get_tensor()
136 tensor.set(np_value, place)
137
138
139def quant_tensor(x, scale, quant_axis=0, weight_bits=8, onnx_format=False):

Callers 2

run_adaroundFunction · 0.85

Calls 2

get_tensorMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected