gnn icon indicating copy to clipboard operation
gnn copied to clipboard

MultiHeadAttentionConv requires non-ragged Tensors as inputs

Open mikehb opened this issue 1 year ago • 0 comments

I want to build a graph where each node (observation node) has variable length sequence of features with uniform inner dimensions. That means each node's feature has shape (partial_seq, fixed_dim). Each observeration node has different partial_seq value because it could observe only part of the items, each item has fixed_dim features . With all the features from the observation nodes, features of predicted nodes are infered and has shape (all_seq,fixed_dim). all_seq is the size of all items on the observation nodes, which means I want to predict the features of all observed items on predicted nodes.

I am new with MultiHeadAttendConv, and I build the graph schema something like this,

node_sets {
  key: "observation_node"
  value {
    features {
      key: "obs"
      value {
        dtype: DT_DOUBLE
        shape {
          dim {
            size: -1   #each observation node has variable items observed
          }
          dim {
            size: 6   #one-hot encoding of item with size 4, plus item's features with size 2
          }
        }
      }
    }
  }
}
node_sets {
  key: "predicted_node"
  value {
    features {
      key: "obs"
      value {
        dtype: DT_FLOAT
        shape {
          dim {
            size: -1  #all items observed by its neighbor observation nodes
          }
          dim {
            size: 4  #one-hot encoding of item with size 4
          }
        }
      }
    }
  }
}
edge_sets {
  key: "bond"
  value {
    features {
      key: "cos_similarity"
      value {
        dtype: DT_DOUBLE
        shape {
          dim {
            size: -1 #observed items from the source
          }
          dim {
            size: 5  #one-hot encoding of item with size 4, plus a cosine similarity
          }
        }
      }
    }
    source: "observation_node"
    target: "predicted_node"
  }
}

I encounted the following log ValueError: MultiHeadAttentionConv requires non-ragged Tensors as inputs, and GraphTensor requires these to have statically known dimensions except the first, but got (None, None, 64)

Can anyone point out how to build a graph schema for my data?

mikehb avatar Jun 26 '24 11:06 mikehb