MCPcopy Create free account
hub / github.com/apache/singa / copy_from

Method copy_from

examples/model_selection/Trails/singa_pkg_code/tensor.py:359–371  ·  view source on GitHub ↗

Copy the data from the numpy array or other Tensor instance Args: t (Tensor or np array): source Tensor or numpy array offset (int): destination offset

(self, t, offset=0)

Source from the content-addressed store, hash-verified

357 self.data.CopyData(t.data)
358
359 def copy_from(self, t, offset=0):
360 ''' Copy the data from the numpy array or other Tensor instance
361
362 Args:
363 t (Tensor or np array): source Tensor or numpy array
364 offset (int): destination offset
365 '''
366 if isinstance(t, Tensor):
367 self.copy_data(t)
368 elif isinstance(t, np.ndarray):
369 self.copy_from_numpy(t)
370 else:
371 raise ValueError("t should be Tensor or numpy array.")
372
373 def clone(self):
374 '''

Callers 12

stepMethod · 0.45
stepMethod · 0.45
stepMethod · 0.45
stepMethod · 0.45
set_paramsMethod · 0.45
set_paramsMethod · 0.45
set_paramsMethod · 0.45
set_statesMethod · 0.45
set_paramsMethod · 0.45
set_statesMethod · 0.45
stepMethod · 0.45
stepMethod · 0.45

Calls 2

copy_dataMethod · 0.95
copy_from_numpyMethod · 0.95

Tested by

no test coverage detected