MCPcopy
hub / github.com/dmlc/dgl / generate_mask_tensor

Function generate_mask_tensor

python/dgl/data/utils.py:389–404  ·  view source on GitHub ↗

Generate mask tensor according to different backend For torch and tensorflow, it will create a bool tensor For mxnet, it will create a float tensor Parameters ---------- mask: numpy ndarray input mask tensor

(mask)

Source from the content-addressed store, hash-verified

387
388
389def generate_mask_tensor(mask):
390 """Generate mask tensor according to different backend
391 For torch and tensorflow, it will create a bool tensor
392 For mxnet, it will create a float tensor
393 Parameters
394 ----------
395 mask: numpy ndarray
396 input mask tensor
397 """
398 assert isinstance(mask, np.ndarray), (
399 "input for generate_mask_tensor" "should be an numpy ndarray"
400 )
401 if F.backend_name == "mxnet":
402 return F.tensor(mask, dtype=F.data_type_dict["float32"])
403 else:
404 return F.tensor(mask, dtype=F.data_type_dict["bool"])
405
406
407class Subset(object):

Callers 12

processMethod · 0.85
loadMethod · 0.85
add_nodepred_splitFunction · 0.85
mask_nodes_by_propertyFunction · 0.85
processMethod · 0.85
process_raw_tuplesMethod · 0.85
processMethod · 0.85
processMethod · 0.85
loadMethod · 0.85
processMethod · 0.85
loadMethod · 0.85
build_knowledge_graphFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected