def build(builder): if blob_object.op_arg_parallel_attr.is_mirrored(): input_blob_def = input_blob_def_util.MirroredTensorDef( ndarray.shape, dtype=dtype_util.convert_numpy_dtype_to_oneflow_dtype(ndarray.dtype), ) else: input_blob_def = input_blob_def_util.FixedTensorDef( ndarray.shape, dtype=dtype_util.convert_numpy_dtype_to_oneflow_dtype(ndarray.dtype), ) push_util.FeedValueToEagerBlob(blob_object, input_blob_def, ndarray)
def build(builder): blob_object = builder.MakeLazyRefBlobObject(op_name) if blob_object.op_arg_blob_attr.is_tensor_list: input_blob_def = input_blob_def_util.MirroredTensorListDef( [x.shape for x in ndarray], dtype=dtype_util.convert_numpy_dtype_to_oneflow_dtype( ndarray.dtype), ) elif blob_object.op_arg_parallel_attr.is_mirrored(): input_blob_def = input_blob_def_util.MirroredTensorDef( ndarray.shape, dtype=dtype_util.convert_numpy_dtype_to_oneflow_dtype( ndarray.dtype), ) else: input_blob_def = input_blob_def_util.FixedTensorDef( ndarray.shape, dtype=dtype_util.convert_numpy_dtype_to_oneflow_dtype( ndarray.dtype), ) push_util.FeedValueToEagerBlob(blob_object, input_blob_def, ndarray) Yield()
def NewInputBlobDef(subclass): return input_blob_def.MirroredTensorDef(subclass.shape, dtype=subclass.dtype)