MCPcopy Index your code
hub / github.com/Project-MONAI/MONAI / get_array

Method get_array

monai/data/meta_tensor.py:356–370  ·  view source on GitHub ↗

Returns a new array in `output_type`, the array shares the same underlying storage when the output is a numpy array. Changes to self tensor will be reflected in the ndarray and vice versa. Args: output_type: output type, see also: :py:func:`monai.utils.convert_d

(self, output_type=np.ndarray, dtype=None, device=None, *_args, **_kwargs)

Source from the content-addressed store, hash-verified

354 return self.as_subclass(torch.Tensor)
355
356 def get_array(self, output_type=np.ndarray, dtype=None, device=None, *_args, **_kwargs):
357 """
358 Returns a new array in `output_type`, the array shares the same underlying storage when the output is a
359 numpy array. Changes to self tensor will be reflected in the ndarray and vice versa.
360
361 Args:
362 output_type: output type, see also: :py:func:`monai.utils.convert_data_type`.
363 dtype: dtype of output data. Converted to correct library type (e.g.,
364 `np.float32` is converted to `torch.float32` if output type is `torch.Tensor`).
365 If left blank, it remains unchanged.
366 device: if the output is a `torch.Tensor`, select device (if `None`, unchanged).
367 _args: currently unused parameters.
368 _kwargs: currently unused parameters.
369 """
370 return convert_data_type(self, output_type=output_type, dtype=dtype, device=device, wrap_sequence=True)[0]
371
372 def set_array(self, src, non_blocking: bool = False, *_args, **_kwargs):
373 """

Callers 3

arrayMethod · 0.95
as_dictMethod · 0.95
astypeMethod · 0.95

Calls 1

convert_data_typeFunction · 0.90

Tested by

no test coverage detected